GetPageLabelsRange Method (GdPicturePDF)
Returns the properties of a specific page labeling range of the currently loaded PDF document.
'Declaration
Public Function GetPageLabelsRange( _
ByVal As Integer, _
ByRef As Integer, _
ByRef As PdfPageLabelStyle, _
ByRef As String, _
ByRef As Integer _
) As GdPictureStatus
Parameters
- LabelingRangeIdx
- The index of the required labeling range. It must be a value from 0 to GdPicturePDF.GetPageLabelsRangeCount-1.
- StartPage
- Output parameter. The page number of the starting page of the specified labeling range.
- Style
- Output parameter. The page labeling style of the specified labeling range. A member of the PdfPageLabelStyle enumeration.
- Prefix
- Output parameter. The label prefix, if any is defined, for page labels of the specified labeling range.
- NumPortion
- Output parameter. The value of the numeric portion for the first page label of the specified labeling range.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
How to retrieve properties of all defined page labeling ranges in the PDF document.
Dim caption As String = "Example: GetPageLabelsRangeCount"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim rangesCount As Integer = gdpicturePDF.GetPageLabelsRangeCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If rangesCount > 0 Then
Dim message As String = "This PDF document contains " + rangesCount.ToString() + " labeling ranges." + vbCrLf
For i As Integer = 0 To rangesCount - 1
Dim startPage As Integer = 0, num As Integer = 0
Dim style As PdfPageLabelStyle = PdfPageLabelStyle.PdfPageLabelStyleUndefined
Dim prefix As String = ""
status = gdpicturePDF.GetPageLabelsRange(i, startPage, style, prefix, num)
If status = GdPictureStatus.OK Then
message = message + "The labeling range with the index " + i.ToString() + " starts at the page number " + startPage.ToString() + " and has these attributes:" + vbCrLf + "style = " + style.ToString() + " prefix = """ + prefix.ToString() + """ num.portion = " + num.ToString() + vbCrLf
Else
message = message + "The GetPageLabelsRange() method has failed for the " + i.ToString() + ". labeling range with the status: " + status.ToString() + vbCrLf
End If
Next
MessageBox.Show(message, caption)
Else
MessageBox.Show("This PDF document doesn't contain any page labeling ranges.", caption)
End If
Else
MessageBox.Show("The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetPageLabelsRangeCount";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int rangesCount = gdpicturePDF.GetPageLabelsRangeCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (rangesCount > 0)
{
string message = "This PDF document contains " + rangesCount.ToString() + " labeling ranges.\n";
for (int i = 0; i < rangesCount; i++)
{
int startPage = 0, num = 0;
PdfPageLabelStyle style = PdfPageLabelStyle.PdfPageLabelStyleUndefined;
string prefix = "";
status = gdpicturePDF.GetPageLabelsRange(i, ref startPage, ref style, ref prefix, ref num);
if (status == GdPictureStatus.OK)
{
message = message + "The labeling range with the index " + i.ToString() + " starts at the page number " + startPage.ToString() + " and has these attributes:\n" +
"style = " + style.ToString() + " prefix = \"" + prefix.ToString() + "\" num.portion = " + num.ToString() + "\n";
}
else
message = message + "The GetPageLabelsRange() method has failed for the " + i.ToString() + ". labeling range with the status: " + status.ToString() + "\n";
}
MessageBox.Show(message, caption);
}
else
MessageBox.Show("This PDF document doesn't contain any page labeling ranges.", caption);
}
else
MessageBox.Show("The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();