Skip to contents

Returns a pdfium_bookmark_list — a list of pdfium_bookmark handles, one per bookmark in the document's outline tree, walked depth-first. Per-attribute getters (pdf_bookmark_title(), pdf_bookmark_page_num(), pdf_bookmark_action_type(), pdf_bookmark_uri(), pdf_bookmark_filepath(), pdf_bookmark_dest_view(), pdf_bookmark_dest_x(), pdf_bookmark_dest_y(), pdf_bookmark_dest_zoom()) operate on a single handle.

Usage

pdf_doc_bookmarks(doc)

Arguments

doc

A pdfium_doc from pdf_doc_open(), or a character path.

Value

A pdfium_bookmark_list (empty if no outline).

Details

The list is flat; the tree shape is recovered from each handle's parent_index field. Top-level bookmarks have parent_index == 0; every other bookmark's parent is the entry whose index matches its parent_index. level is the 1-based nesting depth.

Use tibble::as_tibble(pdf_doc_bookmarks(doc)) for the tibble view.

Wraps FPDFBookmark_GetFirstChild, FPDFBookmark_GetNextSibling, FPDFBookmark_GetTitle, FPDFBookmark_GetDest, FPDFBookmark_GetAction, FPDFAction_GetType / FPDFAction_GetURIPath / FPDFAction_GetFilePath, and FPDFDest_GetDestPageIndex.

See also

pdf_page_labels() for logical page numbering, pdf_page_links() for clickable link annotations on a page, pdf_parse_date() for parsing date-shaped action strings.

Examples

fixture <- system.file("extdata", "fixtures", "outline.pdf",
  package = "pdfium"
)
if (nzchar(fixture)) pdf_doc_bookmarks(fixture)
#> <pdfium_bookmark_list: 3 bookmark(s)>
#>   [[1]] <pdfium_bookmark [open] Chapter 1, idx 1, level 1>
#>   [[2]] <pdfium_bookmark [open] Section 1.1, idx 2, level 2>
#>   [[3]] <pdfium_bookmark [open] Section 1.2, idx 3, level 2>