A unique bookmark identifier specifying a required bookmark object.

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

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetBookmarkParentID Method

GetBookmarkParentID Method (GdPicturePDF)

In This Topic
Returns a unique identifier of the parent bookmark item for the specified bookmark in the bookmark's hierarchy of the currently loaded PDF document.
Syntax
'Declaration

 

Public Function GetBookmarkParentID( _

   ByVal BookmarkID As Integer _

) As Integer
public int GetBookmarkParentID( 

   int BookmarkID

)
public function GetBookmarkParentID( 

    BookmarkID: Integer

): Integer; 
public function GetBookmarkParentID( 

   BookmarkID : int

) : int;
public: int GetBookmarkParentID( 

   int BookmarkID

) 
public:

int GetBookmarkParentID( 

   int BookmarkID

) 

Parameters

BookmarkID
A unique bookmark identifier specifying a required bookmark object.

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

Return Value

A unique bookmark identifier of the parent bookmark item for the specified bookmark. 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 has no parent bookmark item, the value of GdPictureStatus.InvalidParameter is returned.

Example
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();
See Also