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();