Dim caption As String = "Example: GetBookmarkFirstChildID"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("bookmarks.pdf", False)
If status = GdPictureStatus.OK Then
Dim rootID As Integer = gdpicturePDF.GetBookmarkRootID()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim childCount As Integer = gdpicturePDF.GetBookmarkChildCount(rootID)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If childCount > 0 Then
Dim childID As Integer = gdpicturePDF.GetBookmarkFirstChildID(rootID)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim parentID As Integer = gdpicturePDF.GetBookmarkParentID(childID)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("This PDF contains bookmarks." + vbCrLf + "Root ID: " + rootID.ToString() + " Root's first child ID: " + childID.ToString() + " Child's parent ID: " + parentID.ToString())
Else
MessageBox.Show("The GetBookmarkParentID() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The GetBookmarkFirstChildID() method has failed with the status: " + status.ToString(), caption)
End If
Else
If childCount = 0 Then
MessageBox.Show("The root bookmark with ID = " + rootID.ToString() + " doesn't contain any child bookmarks.", caption)
End If
End If
Else
MessageBox.Show("The GetBookmarkChildCount() method has failed with the status: " + status.ToString(), caption)
End If
Else
If status = GdPictureStatus.PropertyNotFound Then
MessageBox.Show("This PDF document doesn't contain any bookmarks.", caption)
Else
MessageBox.Show("The GetBookmarkRootID() method has failed with the status: " + status.ToString(), caption)
End If
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetBookmarkFirstChildID";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("bookmarks.pdf", false);
if (status == GdPictureStatus.OK)
{
int rootID = gdpicturePDF.GetBookmarkRootID();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
int childCount = gdpicturePDF.GetBookmarkChildCount(rootID);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (childCount > 0)
{
int childID = gdpicturePDF.GetBookmarkFirstChildID(rootID);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
int parentID = gdpicturePDF.GetBookmarkParentID(childID);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
MessageBox.Show("This PDF contains bookmarks.\nRoot ID: " + rootID.ToString() + " Root's first child ID: " + childID.ToString() + " Child's parent ID: " + parentID.ToString());
else
MessageBox.Show("The GetBookmarkParentID() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The GetBookmarkFirstChildID() method has failed with the status: " + status.ToString(), caption);
}
else
{
if (childCount == 0)
MessageBox.Show("The root bookmark with ID = " + rootID.ToString() + " doesn't contain any child bookmarks.", caption);
}
}
else
MessageBox.Show("The GetBookmarkChildCount() method has failed with the status: " + status.ToString(), caption);
}
else
{
if (status == GdPictureStatus.PropertyNotFound)
MessageBox.Show("This PDF document doesn't contain any bookmarks.", caption);
else
MessageBox.Show("The GetBookmarkRootID() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
gdpicturePDF.Dispose();