GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetPageLabelsRangePrefix Method
The index of the required labeling range. It must be a value from 0 to GetPageLabelsRangeCount-1.
Defines the new label prefix of the required labeling range.
Example





In This Topic
SetPageLabelsRangePrefix Method (GdPicturePDF)
In This Topic
Modifies the label prefix of the labeling range, specified by its index, of the currently loaded PDF document.
Syntax
'Declaration
 
Public Function SetPageLabelsRangePrefix( _
   ByVal LabelingRangeIdx As Integer, _
   ByVal Prefix As String _
) As GdPictureStatus
public GdPictureStatus SetPageLabelsRangePrefix( 
   int LabelingRangeIdx,
   string Prefix
)
public function SetPageLabelsRangePrefix( 
    LabelingRangeIdx: Integer;
    Prefix: String
): GdPictureStatus; 
public function SetPageLabelsRangePrefix( 
   LabelingRangeIdx : int,
   Prefix : String
) : GdPictureStatus;
public: GdPictureStatus SetPageLabelsRangePrefix( 
   int LabelingRangeIdx,
   string* Prefix
) 
public:
GdPictureStatus SetPageLabelsRangePrefix( 
   int LabelingRangeIdx,
   String^ Prefix
) 

Parameters

LabelingRangeIdx
The index of the required labeling range. It must be a value from 0 to GetPageLabelsRangeCount-1.
Prefix
Defines the new label prefix of the required 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.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to reset the current page labeling range attributes to the new ones according to your preference.
Dim caption As String = "Example: SetPageLabelsRangePrefix"
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 = ""
            Dim startPage As Integer = 0, num As Integer = 0
            Dim style As PdfPageLabelStyle = PdfPageLabelStyle.PdfPageLabelStyleUndefined
            Dim prefix As String = ""
            status = gdpicturePDF.GetPageLabelsRange(0, startPage, style, prefix, num)
            If status = GdPictureStatus.OK Then
                message = message + "The previously defined attributes for the first labeling range are:" + vbCrLf + "style = " + style.ToString() + vbCrLf + "prefix = """ + prefix.ToString() + """" + vbCrLf + "num.portion = " + num.ToString() + vbCrLf
            Else
                message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + vbCrLf
            End If
            
            status = gdpicturePDF.SetPageLabelsRangeNumPortion(0, 5)
            If status <> GdPictureStatus.OK Then
                message = message + "The SetPageLabelsRangeNumPortion() method has failed with the status: " + status.ToString() + vbCrLf
            End If
            status = gdpicturePDF.SetPageLabelsRangePrefix(0, "Prefix:")
            If status <> GdPictureStatus.OK Then
                message = message + "The SetPageLabelsRangePrefix() method has failed with the status: " + status.ToString() + vbCrLf
            End If
            status = gdpicturePDF.SetPageLabelsRangeStyle(0, PdfPageLabelStyle.PdfPageLabelStyleLowercaseRomanNumerals)
            If status <> GdPictureStatus.OK Then
                message = message + "The SetPageLabelsRangeStyle() method has failed with the status: " + status.ToString() + vbCrLf
            End If
            
            status = gdpicturePDF.GetPageLabelsRange(0, startPage, style, prefix, num)
            If status = GdPictureStatus.OK Then
                message = message + "The newly defined attributes for the first labeling range are:" + vbCrLf + "style = " + style.ToString() + vbCrLf + "prefix = """ + prefix.ToString() + """" + vbCrLf + "num.portion = " + num.ToString() + vbCrLf
            Else
                message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + vbCrLf
            End If
            
            If gdpicturePDF.SaveToFile("test_SetPageLabelsRangeAttributes.pdf") = GdPictureStatus.OK Then
                MessageBox.Show("The file has been saved successfully.", caption)
            Else
                MessageBox.Show("The file can't be saved.", caption)
            End If
            MessageBox.Show(message, caption)
        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: SetPageLabelsRangePrefix";
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 = "";
            int startPage = 0, num = 0;
            PdfPageLabelStyle style = PdfPageLabelStyle.PdfPageLabelStyleUndefined;
            string prefix = "";
            status = gdpicturePDF.GetPageLabelsRange(0, ref startPage, ref style, ref prefix, ref num);
            if (status == GdPictureStatus.OK)
            {
                message = message + "The previously defined attributes for the first labeling range are:\n" +
                                    "style = " + style.ToString() + "\nprefix = \"" + prefix.ToString() + "\"\nnum.portion = " + num.ToString() + "\n";
            }
            else
                message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + "\n";
            
            status = gdpicturePDF.SetPageLabelsRangeNumPortion(0, 5);
            if (status != GdPictureStatus.OK)
                message = message + "The SetPageLabelsRangeNumPortion() method has failed with the status: " + status.ToString() + "\n";
            status = gdpicturePDF.SetPageLabelsRangePrefix(0, "Prefix:");
            if (status != GdPictureStatus.OK)
                message = message + "The SetPageLabelsRangePrefix() method has failed with the status: " + status.ToString() + "\n";
            status = gdpicturePDF.SetPageLabelsRangeStyle(0, PdfPageLabelStyle.PdfPageLabelStyleLowercaseRomanNumerals);
            if (status != GdPictureStatus.OK)
                message = message + "The SetPageLabelsRangeStyle() method has failed with the status: " + status.ToString() + "\n";
            
            status = gdpicturePDF.GetPageLabelsRange(0, ref startPage, ref style, ref prefix, ref num);
            if (status == GdPictureStatus.OK)
            {
                message = message + "The newly defined attributes for the first labeling range are:\n" +
                                    "style = " + style.ToString() + "\nprefix = \"" + prefix.ToString() + "\"\nnum.portion = " + num.ToString() + "\n";
            }
            else
                message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + "\n";
            
            if (gdpicturePDF.SaveToFile("test_SetPageLabelsRangeAttributes.pdf") == GdPictureStatus.OK)
                MessageBox.Show("The file has been saved successfully.", caption);
            else
                MessageBox.Show("The file can't be saved.", caption);
            MessageBox.Show(message, 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