BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

ExtractAllBookmarks Method

Extracts all bookmarks from a PDF file and return an XML string to the caller.
The data contained in the XML string can be used to invoke AppendBookmark function in BCL easyPDF SDK for adding bookmarks in PDF file.

 Function ExtractAllBookmarks(InputFileName As String, [Optional] Password As String) As String
 String ExtractAllBookmarks(string InputFileName, string Password)
 String ExtractAllBookmarks(String InputFileName, String Password) throws PDFProcessorException

Parameters

InputFileName

Input file name.

Password (optional)

A password string for opening the document, if the document is encrypted.

Return Values

String in an XML format.

Sample XML string will look like the following:

<?xml version="1.0" encoding="utf-8" ?> 
<Bookmarks>
<Bookmark id="1" title="1. Introduction" depth="0" page="0"/>
<Bookmark id="2" title="1.1. Background" depth="1" page="0"/>
<Bookmark id="3" title="1.2. Investigational Agent" depth="2" page="0"/>
<Bookmark id="4" title="2. Study Objectives" depth="0" page="3"/>
<Bookmark id="5" title="3. Study Design" depth="0" page="3"/>
<Bookmark id="6" title="3.1. General Design" depth="1" page="3"/>
.........................................
.........................................
</Bookmarks>



Remarks

Note:
New attributes can be added to Bookmark element if needed and the ID attribute is important since it also stands for the order to invoke AppendBookmark () method.
Assumption: The user needs to know how to parse data from an XML string.

Example Usage

PDFProcessor oProcessor = new PDFProcessor();
string bookmarks =  oProcessor.ExtractAllBookmarks(@"C:\test\input.pdf", "");
File.WriteAllText(@"c:\test\output.xml",  bookmarks);