Dim caption As String = "Example: GetPageLinkAnnotationIdx"
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
Dim message As String = ""
For i As Integer = 0 To linksCount - 1
message = message + "Link Nr." + (i + 1).ToString()
Dim annotIdx As Integer = gdpicturePDF.GetPageLinkAnnotationIdx(i)
If (gdpicturePDF.GetStat() = GdPictureStatus.OK) AndAlso (gdpicturePDF.SetAnnotationColor(annotIdx, 255, 0, 0) = GdPictureStatus.OK) Then
message = message + " has changed its color successfully." + vbCrLf
Else
message = message + " has failed to change its color." + vbCrLf
End If
Next
If gdpicturePDF.SaveToFile("linksColoured.pdf") = GdPictureStatus.OK Then
MessageBox.Show(message + "The file has been saved successfully.", caption)
Else
MessageBox.Show(message + "The file can't be saved.", 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: GetPageLinkAnnotationIdx";
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)
{
string message = "";
for (int i = 0; i <= linksCount - 1; i++)
{
message = message + "Link Nr." + (i + 1).ToString();
int annotIdx = gdpicturePDF.GetPageLinkAnnotationIdx(i);
if ((gdpicturePDF.GetStat() == GdPictureStatus.OK) &&
(gdpicturePDF.SetAnnotationColor(annotIdx, 255, 0, 0) == GdPictureStatus.OK))
{
message = message + " has changed its color successfully.\n";
}
else
{
message = message + " has failed to change its color.\n";
}
}
if (gdpicturePDF.SaveToFile("linksColoured.pdf") == GdPictureStatus.OK)
{
MessageBox.Show(message + "The file has been saved successfully.", caption);
}
else
{
MessageBox.Show(message + "The file can't be saved.", 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();