Dim caption As String = "Example: GetPageLinksCount"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("links.pdf", False)
If status = GdPictureStatus.OK Then
Dim totalLinksCount As Integer = 0
Dim pagesCount As Integer = gdpicturePDF.GetPageCount()
If (gdpicturePDF.GetStat() = GdPictureStatus.OK) AndAlso (pagesCount > 0) Then
Dim linksPerPages As String = ""
For i As Integer = 1 To pagesCount
linksPerPages = linksPerPages + "Page Nr." + i.ToString()
status = gdpicturePDF.SelectPage(i)
If status = GdPictureStatus.OK Then
Dim linksCount As Integer = gdpicturePDF.GetPageLinksCount()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If linksCount = 0 Then
linksPerPages = linksPerPages + " has no links." + vbCrLf
Else
linksPerPages = linksPerPages + " has " + linksCount.ToString() + " links." + vbCrLf
totalLinksCount = totalLinksCount + linksCount
End If
Else
linksPerPages = linksPerPages + " has failed to find links. The reason: " + status.ToString() + vbCrLf
End If
Else
linksPerPages = linksPerPages + " has failed to select." + vbCrLf
End If
Next
MessageBox.Show("This PDF document contains " + totalLinksCount.ToString() + " links." + vbCrLf + linksPerPages, caption)
Else
MessageBox.Show("The file has failed to load pages.", caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetPageLinksCount";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("links.pdf", false);
if (status == GdPictureStatus.OK)
{
int totalLinksCount = 0;
int pagesCount = gdpicturePDF.GetPageCount();
if ((gdpicturePDF.GetStat() == GdPictureStatus.OK) && (pagesCount > 0))
{
string linksPerPages = "";
for (int i = 1; i <= pagesCount; i++)
{
linksPerPages = linksPerPages + "Page Nr." + i.ToString();
status = gdpicturePDF.SelectPage(i);
if (status == GdPictureStatus.OK)
{
int linksCount = gdpicturePDF.GetPageLinksCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (linksCount == 0)
linksPerPages = linksPerPages + " has no links.\n";
else
{
linksPerPages = linksPerPages + " has " + linksCount.ToString() + " links.\n";
totalLinksCount = totalLinksCount + linksCount;
}
}
else
{
linksPerPages = linksPerPages + " has failed to find links. The reason: " + status.ToString() + "\n";
}
}
else
{
linksPerPages = linksPerPages + " has failed to select.\n";
}
}
MessageBox.Show("This PDF document contains " + totalLinksCount.ToString() + " links.\n" + linksPerPages, caption);
}
else
{
MessageBox.Show("The file has failed to load pages.", caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();