GetBookmarkParentID Method (GdPicturePDF)
Returns a unique identifier of the parent bookmark item for the specified bookmark in the bookmark's hierarchy of the currently loaded PDF document.
public int GetBookmarkParentID(
int
)
public function GetBookmarkParentID(
: Integer
): Integer;
public function GetBookmarkParentID(
: int
) : int;
public: int GetBookmarkParentID(
int
)
public:
int GetBookmarkParentID(
int
)
'Declaration
Public Function GetBookmarkParentID( _
ByVal As Integer _
) As Integer
Parameters
- BookmarkID
- A unique bookmark identifier specifying a required bookmark object.
You can obtain this identifier using these methods: GdPicturePDF.NewBookmark, GdPicturePDF.GetBookmarkRootID, GdPicturePDF.GetBookmarkFirstChildID, GdPicturePDF.GetBookmarkNextID or GdPicturePDF.GetBookmarkPrevID.
Return Value
A unique bookmark identifier of the parent bookmark item for the specified bookmark. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
How to find out the parent bookmark identifier of the specified bookmark item.
Dim caption As String = "Example: GetBookmarkParentID"
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) AndAlso (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 (status = GdPictureStatus.OK) AndAlso (childCount = 0) Then
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)
End If
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: GetBookmarkParentID";
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) && (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 ((status == GdPictureStatus.OK) && (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();