GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetPageLabelsRangeStartPage Method
The index of the required labeling range. It must be a value from 0 to GetPageLabelsRangeCount-1.
Defined the new starting page of the required labeling range. It must be a value from 1 to GetPageCount.
Example





In This Topic
SetPageLabelsRangeStartPage Method (GdPicturePDF)
In This Topic
Modifies the starting page of the labeling range, specified by its index, of the currently loaded PDF document.
Syntax
'Declaration
 
Public Function SetPageLabelsRangeStartPage( _
   ByVal LabelingRangeIdx As Integer, _
   ByVal StartPage As Integer _
) As GdPictureStatus
public GdPictureStatus SetPageLabelsRangeStartPage( 
   int LabelingRangeIdx,
   int StartPage
)
public function SetPageLabelsRangeStartPage( 
    LabelingRangeIdx: Integer;
    StartPage: Integer
): GdPictureStatus; 
public function SetPageLabelsRangeStartPage( 
   LabelingRangeIdx : int,
   StartPage : int
) : GdPictureStatus;
public: GdPictureStatus SetPageLabelsRangeStartPage( 
   int LabelingRangeIdx,
   int StartPage
) 
public:
GdPictureStatus SetPageLabelsRangeStartPage( 
   int LabelingRangeIdx,
   int StartPage
) 

Parameters

LabelingRangeIdx
The index of the required labeling range. It must be a value from 0 to GetPageLabelsRangeCount-1.
StartPage
Defined the new starting page of the required labeling range. It must be a value from 1 to GetPageCount.

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.

Be aware that if you modify the StartPage parameter of the required labeling range, which has been previously set to the number 1, to be the new greater value, the supplementary labeling range is created for the pages outside the newly defined interval, that means the new page labeling range with the index 0 is added to the document, starting at the first page and ending at the page before your newly specified StartPage.

Example
How to change the starting page of the specified page labeling range.
Dim caption As String = "Example: SetPageLabelsRangeStartPage"
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 pageCount As Integer = gdpicturePDF.GetPageCount()
            status = gdpicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                status = gdpicturePDF.SetPageLabelsRangeStartPage(0, pageCount)
                If status = GdPictureStatus.OK Then
                    If gdpicturePDF.SaveToFile("test_SetPageLabelsRangeStartPage.pdf") = GdPictureStatus.OK Then
                        MessageBox.Show("The starting page for the first labeling range has been reset successfully and the file has been saved.", caption)
                    Else
                        MessageBox.Show("The starting page for the first labeling range has been reset successfully, but the file can't be saved.", caption)
                    End If
                Else
                    MessageBox.Show("The SetPageLabelsRangeStartPage() method has failed with the status: " + status.ToString(), caption)
                End If
            Else
                MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("No page labeling ranges are defined in this PDF document.", 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: SetPageLabelsRangeStartPage";
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)
        {
            int pageCount = gdpicturePDF.GetPageCount();
            status = gdpicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                status = gdpicturePDF.SetPageLabelsRangeStartPage(0, pageCount);
                if (status == GdPictureStatus.OK)
                {
                    if (gdpicturePDF.SaveToFile("test_SetPageLabelsRangeStartPage.pdf") == GdPictureStatus.OK)
                        MessageBox.Show("The starting page for the first labeling range has been reset successfully and the file has been saved.", caption);
                    else
                        MessageBox.Show("The starting page for the first labeling range has been reset successfully, but the file can't be saved.", caption);
                }
                else
                    MessageBox.Show("The SetPageLabelsRangeStartPage() method has failed with the status: " + status.ToString(), caption);
            }
            else
                MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("No page labeling ranges are defined in this PDF document.", 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();
See Also