A unique bookmark identifier specifying a required bookmark object.

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

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetBookmarkTextAttribute Method

GetBookmarkTextAttribute Method (GdPicturePDF)

In This Topic
Returns the style characteristics of the text (used to display the bookmark's title) of a bookmark item specified by its unique identifier. The supported characteristics are italic, bold and bold&italic.
Syntax
'Declaration

 

Public Function GetBookmarkTextAttribute( _

   ByVal BookmarkID As Integer _

) As Integer
public int GetBookmarkTextAttribute( 

   int BookmarkID

)
public function GetBookmarkTextAttribute( 

    BookmarkID: Integer

): Integer; 
public function GetBookmarkTextAttribute( 

   BookmarkID : int

) : int;
public: int GetBookmarkTextAttribute( 

   int BookmarkID

) 
public:

int GetBookmarkTextAttribute( 

   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, GetBookmarkPrevID or GetBookmarkParentID.

Return Value

The style characteristics of the bookmark's text of the specified bookmark item as an integer value. The values are defined as follows: 1 means Italic text, 2 means Bold text, 3 means Bold&Italic text.

The GetStat method can be subsequently used to determine if this method has been successful. The GdPictureStatus.PropertyNotFound denotes that the text is displayed as normal (plain) text by default.

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.

Example
How to find out the style characteristics of the text used to display the bookmark's title for the root bookmark.
Dim caption As String = "Example: GetBookmarkTextAttribute"

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 message As String = "The style of the text used for displaying the title of the root bookmark is :" + vbCrLf

        Dim textAttr As Integer = gdpicturePDF.GetBookmarkTextAttribute(rootID)

        status = gdpicturePDF.GetStat()

        If status = GdPictureStatus.OK Then

            Select Case textAttr

                Case 1

                    message = message + "Italic"

                    Exit Select

                Case 2

                    message = message + "Bold"

                    Exit Select

                Case 3

                    message = message + "Bold & Italic"

                    Exit Select

                Case Else

                    message = "An error value is detected. Value: " + textAttr.ToString()

                    Exit Select

            End Select

            MessageBox.Show(message, caption)

        Else

            If status = GdPictureStatus.PropertyNotFound Then

                message = message + "normal (plain text)"

                MessageBox.Show(message, caption)

            Else

                MessageBox.Show("The GetBookmarkTextAttribute() 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: GetBookmarkTextAttribute";

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)

    {

        string message = "The style of the text used for displaying the title of the root bookmark is :\n";

        int textAttr = gdpicturePDF.GetBookmarkTextAttribute(rootID);

        status = gdpicturePDF.GetStat();

        if (status == GdPictureStatus.OK)

        {

            switch (textAttr)

            {

                case 1: message = message + "Italic"; break;

                case 2: message = message + "Bold"; break;

                case 3: message = message + "Bold & Italic"; break;

                default: message = "An error value is detected. Value: " + textAttr.ToString(); break;

            }

            MessageBox.Show(message, caption);

        }

        else

        {

            if (status == GdPictureStatus.PropertyNotFound)

            {

                message = message + "normal (plain text)";

                MessageBox.Show(message, caption);

            }

            else

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