A unique bookmark identifier specifying a required bookmark object, which you want to move.

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

A unique bookmark identifier specifying a destination bookmark object.

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

Specifies the positioning of the moved bookmark item considering the destination bookmark item.

Set this parameter to true if you want to move the required bookmark item just before the destination bookmark item. Set this parameter to false if you want to move the required bookmark item just after the destination bookmark item.

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / MoveBookmark Method

MoveBookmark Method (GdPicturePDF)

In This Topic
Moves one specified bookmark item just before or just after another specified (destination) bookmark item within the level of the destination bookmark in the bookmark's hierarchy.
Syntax
'Declaration

 

Public Function MoveBookmark( _

   ByVal BookmarkID As Integer, _

   ByVal BookmarkDestID As Integer, _

   ByVal Before As Boolean _

) As GdPictureStatus
public GdPictureStatus MoveBookmark( 

   int BookmarkID,

   int BookmarkDestID,

   bool Before

)
public function MoveBookmark( 

    BookmarkID: Integer;

    BookmarkDestID: Integer;

    Before: Boolean

): GdPictureStatus; 
public function MoveBookmark( 

   BookmarkID : int,

   BookmarkDestID : int,

   Before : boolean

) : GdPictureStatus;
public: GdPictureStatus MoveBookmark( 

   int BookmarkID,

   int BookmarkDestID,

   bool Before

) 
public:

GdPictureStatus MoveBookmark( 

   int BookmarkID,

   int BookmarkDestID,

   bool Before

) 

Parameters

BookmarkID
A unique bookmark identifier specifying a required bookmark object, which you want to move.

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

BookmarkDestID
A unique bookmark identifier specifying a destination bookmark object.

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

Before
Specifies the positioning of the moved bookmark item considering the destination bookmark item.

Set this parameter to true if you want to move the required bookmark item just before the destination bookmark item. Set this parameter to false if you want to move the required bookmark item just after the destination bookmark item.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to move the last bookmark item, located on the same level as the root bookmark item is, just after the root bookmark.
Dim caption As String = "Example: MoveBookmark"

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 bookmarkID As Integer = 0, lastBookmarkID As Integer = rootID

        Do

            bookmarkID = gdpicturePDF.GetBookmarkNextID(lastBookmarkID)

            status = gdpicturePDF.GetStat()

            If status = GdPictureStatus.OK Then

                lastBookmarkID = bookmarkID

            ElseIf status <> GdPictureStatus.PropertyNotFound Then

                MessageBox.Show("The GetBookmarkNextID() method has failed with the status: " + status.ToString(), caption)

            End If

        Loop While status = GdPictureStatus.OK

        If lastBookmarkID = rootID Then

            MessageBox.Show("The root bookmark can't move within its level - it has no next bookmarks.", caption)

        Else

            If (status = GdPictureStatus.PropertyNotFound) Then

                'The GetBookmarkNextID() method returns this status when no other bookmark is available.

                status = gdpicturePDF.MoveBookmark(lastBookmarkID, rootID, False)

                If status = GdPictureStatus.OK Then

                    If gdpicturePDF.SaveToFile("bookmarks_Move.pdf", False) = GdPictureStatus.OK Then

                        MessageBox.Show("The example has been followed successfully.", caption)

                    Else

                        MessageBox.Show("The file can't be saved.", caption)

                    End If

                Else

                    MessageBox.Show("The MoveBookmark() method has failed with the status: " + status.ToString(), caption)

                End If

            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: MoveBookmark";

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 bookmarkID = 0, lastBookmarkID = rootID;

        do

        {

            bookmarkID = gdpicturePDF.GetBookmarkNextID(lastBookmarkID);

            status = gdpicturePDF.GetStat();

            if (status == GdPictureStatus.OK)

                lastBookmarkID = bookmarkID;

            else

                if (status != GdPictureStatus.PropertyNotFound)

                MessageBox.Show("The GetBookmarkNextID() method has failed with the status: " + status.ToString(), caption);

        }

        while (status == GdPictureStatus.OK);

        if (lastBookmarkID == rootID)

            MessageBox.Show("The root bookmark can't move within its level - it has no next bookmarks.", caption);

        else

        {

            //The GetBookmarkNextID() method returns this status when no other bookmark is available.

            if (status == GdPictureStatus.PropertyNotFound)

            {

                status = gdpicturePDF.MoveBookmark(lastBookmarkID, rootID, false);

                if (status == GdPictureStatus.OK)

                {

                    if (gdpicturePDF.SaveToFile("bookmarks_Move.pdf", false) == GdPictureStatus.OK)

                        MessageBox.Show("The example has been followed successfully.", caption);

                    else

                        MessageBox.Show("The file can't be saved.", caption);

                }

                else

                {

                    MessageBox.Show("The MoveBookmark() 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