next up previous contents index
Next: Presentations Up: cpdflibmanual Previous: Decompressing a document   Contents   Index

Bookmarks


\begin{framed}
\noindent\textit{Function Summary}\\ [2mm]
\noindent\begin{tabula...
...rb!RemoveBookmarks! & Remove bookmarks from a document
\end{tabular}\end{framed}

PDF Bookmarks (properly called the document outline) represent a tree of references to parts of the file, typically displayed at the side of the screen. The user can click on one to move to the specified place. Cpdflib provides facilities to list, add, and remove bookmarks. The format used by the list and add operations is the same, so you can feed the output of one into the other, for instance to copy bookmarks.

Each bookmark has four elements:
\begin{framed}
\begin{tabular}{lll}
\verb!level! & Integer & Level of bookmark (...
...Boolean & If true this bookmark's children are visible
\end{tabular}\end{framed}
For example:
\begin{framed}
\begin{tabular}{llll}
\texttt{level} & \texttt{string} & \texttt{...
... ''Part 2'' & 8 & false\\
1 & ''Part 2a'' & 9 & false
\end{tabular}\end{framed}

If the page number is 0, it indicates that clicking on that entry doesn't move to a page.

To add bookmarks, build a suitable bookmark array using MakeBookmarks and call AddBookmarks.


\begin{framed}
\noindent\textit{Make and add bookmarks to a document}
\par
\vspa...
...dflib.AddBookmarks(pdf, marks)!
\end{minipage}\\ [5mm]
\end{tabular}\end{framed}
It's important that the bookmarks passed to AddBookmarks are consistent - that is, that the levels represent a proper tree form.

The function GetBookmarks returns an array of all the bookmarks (if any) in a document.


\begin{framed}
\noindent\textit{Get the bookmarks from a PDF}
\par
\vspace{2mm}
...
...() = Cpdflib.GetBookmarks(pdf)!
\end{minipage}\\ [5mm]
\end{tabular}\end{framed}

The bookmark data structure can then be inspected:
\begin{framed}
\noindent\textit{Write the title of a bookmark 'mark' to screen}
...
...b!Console.WriteLine(mark.text)!
\end{minipage}\\ [5mm]
\end{tabular}\end{framed}

The bookmarks in a document can be removed with RemoveBookmarks.
\begin{framed}
\noindent\textit{Remove bookmarks}
\par
\vspace{2mm}
\noindent\be...
...b!Cpdflib.RemoveBookmarks(pdf)!
\end{minipage}\\ [5mm]
\end{tabular}\end{framed}


next up previous contents index
Next: Presentations Up: cpdflibmanual Previous: Decompressing a document   Contents   Index
root 2008-12-01