GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SetBookmarkTitle Method
A unique bookmark identifier specifying a required bookmark object.

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

The new title to be used for a specified bookmark item.
Example





In This Topic
SetBookmarkTitle Method (GdPicturePDF)
In This Topic
Sets the title of a bookmark item specified by its unique identifier.
Syntax
'Declaration
 
Public Function SetBookmarkTitle( _
   ByVal BookmarkID As Integer, _
   ByVal Title As String _
) As GdPictureStatus
public GdPictureStatus SetBookmarkTitle( 
   int BookmarkID,
   string Title
)
public function SetBookmarkTitle( 
    BookmarkID: Integer;
    Title: String
): GdPictureStatus; 
public function SetBookmarkTitle( 
   BookmarkID : int,
   Title : String
) : GdPictureStatus;
public: GdPictureStatus SetBookmarkTitle( 
   int BookmarkID,
   string* Title
) 
public:
GdPictureStatus SetBookmarkTitle( 
   int BookmarkID,
   String^ Title
) 

Parameters

BookmarkID
A unique bookmark identifier specifying a required bookmark object.

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

Title
The new title to be used for a specified 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 change the title of the root bookmark in the PDF document.
Dim caption As String = "Example: SetBookmarkTitle"
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
        status = gdpicturePDF.SetBookmarkTitle(rootID, "GdPicturePDF")
        If status = GdPictureStatus.OK Then
            status = gdpicturePDF.SaveToFile("bookmarks_SetTitle.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully.", caption)
            Else
                MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The SetBookmarkTitle() 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: SetBookmarkTitle";
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)
    {
        status = gdpicturePDF.SetBookmarkTitle(rootID, "GdPicturePDF");
        if (status == GdPictureStatus.OK)
        {
            status = gdpicturePDF.SaveToFile("bookmarks_SetTitle.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully.", caption);
            else
                MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The SetBookmarkTitle() 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