GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / RemovePageLink Method
The 0-based link index within the currently selected page. It must be a value from 0 to GdPicturePDF.GetPageLinksCount-1.
Example





In This Topic
RemovePageLink Method (GdPicturePDF)
In This Topic
Removes a link specified by its index related to the currently selected page of the loaded PDF document.
Syntax
'Declaration
 
Public Function RemovePageLink( _
   ByVal LinkIdx As Integer _
) As GdPictureStatus
public GdPictureStatus RemovePageLink( 
   int LinkIdx
)
public function RemovePageLink( 
    LinkIdx: Integer
): GdPictureStatus; 
public function RemovePageLink( 
   LinkIdx : int
) : GdPictureStatus;
public: GdPictureStatus RemovePageLink( 
   int LinkIdx
) 
public:
GdPictureStatus RemovePageLink( 
   int LinkIdx
) 

Parameters

LinkIdx
The 0-based link index within the currently selected page. It must be a value from 0 to GdPicturePDF.GetPageLinksCount-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.

Also, be sure that you have selected the correct page to work with.

Example
How to remove the first link embedded within the first page of the PDF document.
Dim caption As String = "Example: RemovePageLink"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("links.pdf", False)
If status = GdPictureStatus.OK Then
    status = gdpicturePDF.SelectPage(1)
    If status = GdPictureStatus.OK Then
        Dim linksCount As Integer = gdpicturePDF.GetPageLinksCount()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            If linksCount > 0 Then
                status = gdpicturePDF.RemovePageLink(0)
                If status = GdPictureStatus.OK Then
                    MessageBox.Show("The first link on the first page has been removed successfully.", caption)
                    If gdpicturePDF.SaveToFile("linksFirstRemoved.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
                Else
                    MessageBox.Show("The RemovePageLink() method has failed with the status: " + status.ToString(), caption)
                End If
            Else
                MessageBox.Show("This page has no links.", caption)
            End If
        Else
            MessageBox.Show("The GetPageLinksCount() method has failed with the status: " + status.ToString(), caption)
        End If
    Else
        MessageBox.Show("The SelectPage() 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: RemovePageLink";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("links.pdf", false);
if (status == GdPictureStatus.OK)
{
    status = gdpicturePDF.SelectPage(1);
    if (status == GdPictureStatus.OK)
    {
        int linksCount = gdpicturePDF.GetPageLinksCount();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
        {
            if (linksCount > 0)
            {
                status = gdpicturePDF.RemovePageLink(0);
                if (status == GdPictureStatus.OK)
                {
                    MessageBox.Show("The first link on the first page has been removed successfully.", caption);
                    if (gdpicturePDF.SaveToFile("linksFirstRemoved.pdf") == GdPictureStatus.OK)
                    {
                        MessageBox.Show("The file has been saved successfully.", caption);
                    }
                    else
                    {
                        MessageBox.Show("The file can't be saved.", caption);
                    }
                }
                else
                {
                    MessageBox.Show("The RemovePageLink() method has failed with the status: " + status.ToString(), caption);
                }
            }
            else
            {
                MessageBox.Show("This page has no links.", caption);
            }
        }
        else
        {
            MessageBox.Show("The GetPageLinksCount() method has failed with the status: " + status.ToString(), caption);
        }
    }
    else
    {
        MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption);
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();
See Also