Skip to main content

Encrypt

encrypt protects the PDF with passwords. Set userPassword, ownerPassword, or both. permissions takes print, printHighQuality, modifyContent, extractText, modifyAnnotations, fillForms and assemble, each true unless you set it to false.
As the last stage of a conversion:
Viewers enforce permissions; a tool that ignores them can still print. Only the user password keeps the content itself secret. Keep AES-256 unless an old reader can’t open it. Encryption comes last: only optimize, render and the extracts may follow it. A PDF/A or Factur-X can’t be encrypted, and an encrypted PDF can’t be signed — see the order rules.

Decrypt

decrypt opens encrypted PDFs and removes their encryption. In a list, it comes first.
To only read an encrypted PDF, the read methods take a password instead, such as PDF.info({ files, password }).

Sign

sign signs the PDF with a certificate you upload, so readers can check who signed it and that nothing changed since.
A PEM pair works the same way:
Sign last: a change after a signature breaks it, so only timestamp, render and the extracts may follow sign. A stage that rewrites the file, such as select, merge, remediate or optimize, refuses a signed PDF. Stamps, rotations, metadata, bookmarks, attachments and tags append to the file and keep the signature. An encrypted PDF signs in two requests: decrypt it, then sign the result.

Timestamp

timestamp adds a document timestamp from an RFC 3161 timestamp authority: proof the PDF existed, unchanged, at that time. It names no signer; to timestamp a signature, give sign a timestampUrl instead.
Gotenberg’s operators decide which authorities it may call: see Gotenberg – timestamp.

Redact

redact removes the content under each region from the file itself, not just from view: the text is gone from the page and from any text a reader extracts. Nothing is drawn in its place. Each region takes a page, and x, y, width and height in points from the bottom-left corner of the page.
Redact first: a stamp only covers what’s under it. See Reference — PDF.