To insert a bookmark into the document, you should do the following:
- Call StartBookmark passing it the desired name of the bookmark.
- Insert the bookmark text using DocumentBuilder methods.
- Call EndBookmark passing it the same name that you used with StartBookmark.
Bookmarks can overlap and span any range. To create a valid bookmark you need to call both StartBookmark and EndBookmark with the same bookmark name.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
Example DocumentBuilderInsertBookmark
Shows how to insert a bookmark into a document using a document builder.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartBookmark("FineBookmark");
builder.Writeln("This is just a fine bookmark.");
builder.EndBookmark("FineBookmark");
[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.StartBookmark("FineBookmark")
builder.Writeln("This is just a fine bookmark.")
builder.EndBookmark("FineBookmark")
[Java]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.startBookmark("FineBookmark");
builder.writeln("This is just a fine bookmark.");
builder.endBookmark("FineBookmark");