A unique bookmark identifier specifying a required bookmark object.

You can obtain this identifier using these methods: NewBookmark, GetBookmarkRootID, GetBookmarkNextID, GetBookmarkPrevID or GetBookmarkParentID.

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetBookmarkFirstChildID Method

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 BookmarkID As Integer _
) As Integer
public int GetBookmarkFirstChildID( 
   int BookmarkID
)
public function GetBookmarkFirstChildID( 
    BookmarkID: Integer
): Integer; 
public function GetBookmarkFirstChildID( 
   BookmarkID : int
) : int;
public: int GetBookmarkFirstChildID( 
   int BookmarkID
) 
public:
int GetBookmarkFirstChildID( 
   int BookmarkID
) 

Parameters

BookmarkID
A unique bookmark identifier specifying a required bookmark object.

You can obtain this identifier using these methods: NewBookmark, GetBookmarkRootID, GetBookmarkNextID, GetBookmarkPrevID or GetBookmarkParentID.

Return Value

A unique bookmark identifier of the first child bookmark item (first descendant in lower level). The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any. For example, if the specified bookmark item doesn't contain any child (descendant) bookmark items, the value of GdPictureStatus.InvalidParameter is returned.

You can also use the GetBookmarkChildCount method to determine if the specified bookmark item contains child (descendant) bookmark items.

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