A PDF processor written in Go.
View the Project on GitHub pdfcpu/pdfcpu
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.
pdfcpu bookmarks import [-r(eplace)] inFile inFileJSON [outFile]
name | description | required | default |
---|---|---|---|
replace | enable replacing existing bookmarks | no | false |
name | description | values |
---|---|---|
v(erbose) | turn on logging | |
vv | verbose logging | |
q(uiet) | quiet mode | |
-o(ffline) | disable http traffic | |
c(onf) | config dir | $path, disable |
opw | owner password | |
upw | user password | |
u(nit) | display unit | po(ints),in(ches),cm,mm |
name | description | required |
---|---|---|
inFile | PDF input file | yes |
inFileJSON | JSON input file | yes |
outFile | PDF output file | no |
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!
$ 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