The Title property is used to get/set the bookmark title.
public Property Title() As String
public string Title [get, set]
It returns the title of the bookmark.
Member of Amyuni.PDFCreator.IacBookmark.
If you have multiple bookmarks having the same title and need to navigate inside the document using the bookmark title, you can add a hidden ID to each bookmark as follows:
bookmark.Title = "Introduction" & Chr$(9) & "1".
Dim root As Amyuni.PDFCreator.IacBookmark
Dim child As Amyuni.PDFCreator.IacBookmark
Dim counter As Integer
Dim file1 As New System.IO.FileStream("DocWithObjects.pdf", System.IO.FileMode.Open)
Dim doc As New Amyuni.PDFCreator.IacDocument(PdfCreator1)
With doc
.Open(file1, "")
'set root bookmark pointing to the specified text object, "acText1"
root = doc.RootBookmark
child = root.InsertChild(0, "root", "acText1")
'insert 3 child bookmarks under root bookmark
'pointing to each specified text objects.
child.InsertChild(0, "child1", "acText2")
child.InsertChild(1, "child2", "acText3")
child.InsertChild(2, "child3", "acText4")
'display all the title of the child bookmarks.
For counter = 0 To child.Count - 1 Step 1
MsgBox("Title of the child at index" & counter & "is" & child.GetChild(counter).Title)
'change the title of the bookmark
child.GetChild(counter).Title = "NewChild" & counter + 1
'display the new title
MsgBox("Its title is now changed to" & child.GetChild(counter).Title)
Next
'save PDF file with bookmarks
Dim file2 As New System.IO.FileStream("NewBookmarksTitles.pdf", System.IO.FileMode.Create)
doc.Save(file2, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
End With
child.Dispose()
root.Dispose()
IacBookmark root;
IacBookmark child;
IacBookmark grandchild;
System.IO.FileStream file1 = new System.IO.FileStream("docWithTextObj.pdf", FileMode.Open);
pdfCreator1.Document.Open(file1, "");
//set root bookmark pointing to the object "acText1"
root = pdfCreator1.Document.RootBookmark;
child = root.InsertChild(0, "root", "acText1");
//insert 2 child bookmarks under root bookmark.
grandchild = child.InsertChild(0, "child1", "acText2");
child.InsertChild(1, "child2", "acText3");
//insert a child bookmark under "child1" bookmark .
grandchild.InsertChild(0, "grandchild1", "acText4");
//displays "root" itis the title of the grandchild's parent.
MessageBox.Show(grandchild.Parent.Title);
System.IO.FileStream file2 = new System.IO.FileStream("testParentProperty.pdf", FileMode.Open);
//save PDF file with bookmarks
pdfCreator1.Document.Save(file2, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);