pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Import Bookmarks

This command imports bookmarks via JSON.

Either import a modified JSON structure generated by pdfcpu bookmarks export or use one as a template for this command.

Have a look at some examples.

Usage

pdfcpu bookmarks import inFile inFileJSON [ outFile ] [flags]

Flags

namedescriptionrequireddefault
replaceenable replacing existing bookmarksnofalse

Common Flags


Arguments

namedescriptionrequired
inFilePDF input fileyes
inFileJSONJSON input fileyes
outFilePDF output fileno

Description

A bookmark is a node in the so called Outline tree of a PDF file. Each bookmark may have kid nodes representing the bookmark hierarchy below:

attributedescriptiontyperequired
titletitleUTF-8 stringyes
pagedestination pageintyes
colorRGB colortriple of floatsno
boldstyle boldboolno
italicstyle italicboolno
kidsbookmark subtreebookmark arrayno

Note: color, bold and italic are not supported by Mac Preview!

Examples

$ pdfcpu bookmarks import bookmarkTree.pdf bookmarkTree.json
pdfcpu: existing outlines

pdfcpu bookmarks import bookmarkTree.pdf bookmarkTree.json --replace

$ pdfcpu bookmarks list bookmarkTree.pdf
Page 1: Level 1
    Page 2: Level 1.1
    Page 3: Level 1.2
        Page 4: Level 1.2.1
Page 5: Level 2
    Page 6: Level 2.1
    Page 7: Level 2.2
    Page 8: Level 2.3