Skip to main content

Write Bookmarks

Writes bookmarks (the document outline / table of contents) into one or more PDF files. You can provide bookmarks as a single list (applied to all files) or as a map of filename to bookmarks for per-file control.

POST/forms/pdfengines/bookmarks/write
Headers
Gotenberg-Output-Filenamestring
The filename of the resulting file - Gotenberg automatically appends the file extension. Defaults to a random UUID filename.
Gotenberg-Tracestring
A custom request ID to identify the request in the logs; overrides the default UUID.
Form Fields
bookmarksjsonrequired
The bookmarks to write (JSON format). Accepts a list of bookmarks or a map of filename to bookmarks. e.g. `[{"title":"Chapter 1","page":1,"children":[]}]`
Form Files
filesfile[]required
PDF files to update.
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/bookmarks/write \
--form files=@/path/to/file.pdf \
--form 'bookmarks=[{"title":"Chapter 1","page":1,"children":[]},{"title":"Chapter 2","page":5,"children":[{"title":"Section 2.1","page":6,"children":[]}]}]' \
-o my.pdf
The updated PDF file.
Content-Disposition: attachment; filename={output-filename.pdf}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}
SponsorsTCMpdfme
Powered byDockerJetBrains