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 [-r(eplace)] inFile inFileJSON [outFile]


Flags

name description required default
replace enable replacing existing bookmarks no false


Common Flags

name description values
v(erbose) turn on logging  
vv verbose logging  
q(uiet) quiet mode  
u(nit) display unit po(ints),in(ches),cm,mm
c(onf) config dir $path, disable
upw user password  
opw owner password  


Arguments

name description required
inFile PDF input file yes
inFileJSON JSON input file yes
outFile PDF output file no


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:

attribute description type required
title title UTF-8 string yes
page destination page int yes
color RGB color triple of floats no
bold style bold bool no
italic style italic bool no
kids bookmark subtree bookmark array no

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 -replace bookmarkTree.pdf bookmarkTree.json

$ 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