The page number of the starting page in the labeling range. It must be a value from 1 to GdPicturePDF.GetPageCount.
A member of the PdfPageLabelStyle enumeration. It defines the page labeling style.
The label prefix for page labels in this range. It can be an empty string.
The value of the numeric portion for the first page label in the range. Subsequent pages are numbered sequentially from this value, which must be greater than or equal to 1. The default value is 1.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / AddPageLabelsRange Method

AddPageLabelsRange Method (GdPicturePDF)

In This Topic
Adds a new page labeling range into the currently loaded PDF document according to what you have specified.

A page labeling range is a series of consecutive pages using the same numbering system. The purpose of page labels is to identify each page visually on the screen or in print. Pages, that are included in the specific labeling range, are defined by the interval starting at the first page specified by the StartPage parameter and always ending at the last page of the document.

All labeling ranges are simply indexed by an integer value from 0 to GdPicturePDF.GetPageLabelsRangeCount-1.

Syntax
'Declaration
 
Public Function AddPageLabelsRange( _
   ByVal StartPage As Integer, _
   ByVal Style As PdfPageLabelStyle, _
   ByVal Prefix As String, _
   ByVal NumPortion As Integer _
) As GdPictureStatus
public GdPictureStatus AddPageLabelsRange( 
   int StartPage,
   PdfPageLabelStyle Style,
   string Prefix,
   int NumPortion
)
public function AddPageLabelsRange( 
    StartPage: Integer;
    Style: PdfPageLabelStyle;
    Prefix: String;
    NumPortion: Integer
): GdPictureStatus; 
public function AddPageLabelsRange( 
   StartPage : int,
   Style : PdfPageLabelStyle,
   Prefix : String,
   NumPortion : int
) : GdPictureStatus;
public: GdPictureStatus AddPageLabelsRange( 
   int StartPage,
   PdfPageLabelStyle Style,
   string* Prefix,
   int NumPortion
) 
public:
GdPictureStatus AddPageLabelsRange( 
   int StartPage,
   PdfPageLabelStyle Style,
   String^ Prefix,
   int NumPortion
) 

Parameters

StartPage
The page number of the starting page in the labeling range. It must be a value from 1 to GdPicturePDF.GetPageCount.
Style
A member of the PdfPageLabelStyle enumeration. It defines the page labeling style.
Prefix
The label prefix for page labels in this range. It can be an empty string.
NumPortion
The value of the numeric portion for the first page label in the range. Subsequent pages are numbered sequentially from this value, which must be greater than or equal to 1. The default value is 1.

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.

Remarks
This method is only allowed for use with non-encrypted documents.

Pages within a labeling range are numbered sequentially in ascending order, starting at the first page specified by the StartPage parameter and always ending at the last page of the document. You also need to be aware that if you add a page range, which begins at the page other than the first page of the document, the supplementary labeling range is created for the pages outside your required interval (starting at the first page and ending at the page before your StartPage).

Example
How to define the roman page labels, which begin at number 10, starting from the first page within the PDF document
Dim caption As String = "Example: AddPageLabelsRange"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
    Dim count As Integer = gdpicturePDF.GetPageCount()
    Dim status As GdPictureStatus = gdpicturePDF.GetStat()
    If status <> GdPictureStatus.OK Then
        MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
        GoTo [error]
    End If
    If count = 0 Then
        MessageBox.Show("This PDF document contains no pages.", caption)
        GoTo [error]
    End If
            
    'Removing current labeling ranges, if any are defined.
    status = gdpicturePDF.DeletePageLabels()
    If status <> GdPictureStatus.OK Then
        MessageBox.Show("The DeletePageLabels() method has failed with the status: " + status.ToString(), caption)
        Goto [Error]
    End If
            
    status = gdpicturePDF.AddPageLabelsRange(1, PdfPageLabelStyle.PdfPageLabelStyleUppercaseRomanNumerals, "A-", 10)
    If status = GdPictureStatus.OK Then
        If gdpicturePDF.SaveToFile("test_AddPageLabelsRange.pdf") = GdPictureStatus.OK Then
            MessageBox.Show("The pages have been labeled successfully and the file has been saved.", caption)
        Else
            MessageBox.Show("The pages have been labeled successfully, but the file can't be saved.", caption)
        End If
    Else
        MessageBox.Show("The AddPageLabelsRange() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
[error]:
gdpicturePDF.Dispose()
string caption = "Example: AddPageLabelsRange";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
    int count = gdpicturePDF.GetPageCount();
    GdPictureStatus status = gdpicturePDF.GetStat();
    if (status != GdPictureStatus.OK)
    {
        MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
        goto error;
    }
    if (count == 0)
    {
        MessageBox.Show("This PDF document contains no pages.", caption);
        goto error;
    }
            
    //Removing current labeling ranges, if any are defined.
    status = gdpicturePDF.DeletePageLabels();
    if (status != GdPictureStatus.OK)
    {
        MessageBox.Show("The DeletePageLabels() method has failed with the status: " + status.ToString(), caption);
        goto error;
    }
            
    status = gdpicturePDF.AddPageLabelsRange(1, PdfPageLabelStyle.PdfPageLabelStyleUppercaseRomanNumerals, "A-", 10);
    if (status == GdPictureStatus.OK)
    {
        if (gdpicturePDF.SaveToFile("test_AddPageLabelsRange.pdf") == GdPictureStatus.OK)
            MessageBox.Show("The pages have been labeled successfully and the file has been saved.", caption);
        else
            MessageBox.Show("The pages have been labeled successfully, but the file can't be saved.", caption);
    }
    else
        MessageBox.Show("The AddPageLabelsRange() method has failed with the status: " + status.ToString(), caption);
}
else
    MessageBox.Show("The file can't be loaded.", caption);
            
error:
gdpicturePDF.Dispose();
See Also