Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / DeletePageLabels Method

DeletePageLabels Method (GdPicturePDF)

In This Topic
Removes all page labels previously defined by the AddPageLabelsRange method within the currently loaded PDF document. This actually means that all defined page labeling ranges are completely removed from the document.
Syntax
'Declaration
 
Public Function DeletePageLabels() As GdPictureStatus
public GdPictureStatus DeletePageLabels()
public function DeletePageLabels(): GdPictureStatus; 
public function DeletePageLabels() : GdPictureStatus;
public: GdPictureStatus DeletePageLabels(); 
public:
GdPictureStatus DeletePageLabels(); 

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 remove all page labels (means all page labeling ranges) within the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
    Dim message As String = ""
    Dim rangesCount As Integer = gdpicturePDF.GetPageLabelsRangeCount()
    Dim status As GdPictureStatus = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        message = rangesCount.ToString() + " page labeling ranges are defined in this PDF document." + vbCrLf
        status = gdpicturePDF.DeletePageLabels()
        If status = GdPictureStatus.OK Then
            message = message + "The page labeling ranges has been successfully deleted." + vbCrLf
            rangesCount = gdpicturePDF.GetPageLabelsRangeCount()
            status = gdpicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                message = rangesCount.ToString() + " page labeling ranges are defined in this PDF document." + vbCrLf
                If gdpicturePDF.SaveToFile("test_DeletePageLabels.pdf") = GdPictureStatus.OK Then
                    message = message + "The file has been saved."
                Else
                    message = message + "The file can't be saved."
                End If
            Else
                message = message + "The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString()
            End If
        Else
            message = message + "The DeletePageLabels() method has failed with the status: " + status.ToString()
        End If
    Else
        message = message + "The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString()
    End If
            
    MessageBox.Show(message, "Example: DeletePageLabels")
Else
    MessageBox.Show("The file can't be loaded.", "Example: DeletePageLabels")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
    string message = "";
    int rangesCount = gdpicturePDF.GetPageLabelsRangeCount();
    GdPictureStatus status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        message = rangesCount.ToString() + " page labeling ranges are defined in this PDF document.\n";
        status = gdpicturePDF.DeletePageLabels();
        if (status == GdPictureStatus.OK)
        {
            message = message + "The page labeling ranges has been successfully deleted.\n";
            rangesCount = gdpicturePDF.GetPageLabelsRangeCount();
            status = gdpicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                message = rangesCount.ToString() + " page labeling ranges are defined in this PDF document.\n";
                if (gdpicturePDF.SaveToFile("test_DeletePageLabels.pdf") == GdPictureStatus.OK)
                    message = message + "The file has been saved.";
                else
                    message = message + "The file can't be saved.";
            }
            else
                message = message + "The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString();
        }
        else
            message = message + "The DeletePageLabels() method has failed with the status: " + status.ToString();
    }
    else
        message = message + "The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString();
            
    MessageBox.Show(message, "Example: DeletePageLabels");
}
else
    MessageBox.Show("The file can't be loaded.", "Example: DeletePageLabels");
gdpicturePDF.Dispose();
See Also