GetBookmarkFirstChildID Method (GdPicturePDF)
In This Topic
Returns a unique identifier of the first child bookmark item (the first descendant on lower level) contained within a specified bookmark item in the
bookmark's hierarchy of the currently loaded PDF document.
Syntax
'Declaration
Public Function GetBookmarkFirstChildID( _
ByVal As Integer _
) As Integer
public int GetBookmarkFirstChildID(
int
)
public function GetBookmarkFirstChildID(
: Integer
): Integer;
public function GetBookmarkFirstChildID(
: int
) : int;
public: int GetBookmarkFirstChildID(
int
)
public:
int GetBookmarkFirstChildID(
int
)
Parameters
- BookmarkID
- A unique bookmark identifier specifying a required bookmark object.
You can obtain this identifier using these methods: GdPicturePDF.NewBookmark, GdPicturePDF.GetBookmarkRootID, GdPicturePDF.GetBookmarkNextID, GdPicturePDF.GetBookmarkPrevID or GdPicturePDF.GetBookmarkParentID.
Return Value
A unique bookmark identifier of the first child bookmark item (first descendant in lower level). The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to find out the bookmark identifier of the first child bookmark item (lower level descendant) of the root bookmark, if it exists.
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();
Example
How to find out the bookmark identifier of the first child bookmark item (lower level descendant) of the root bookmark, if it exists.
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();
See Also