Skip to main content

Encrypt PDFs

Secure your PDF by setting passwords that control access and permissions.

  • User Password: Required to open and view the PDF.
  • Owner Password: Required to modify permissions (e.g., printing, copying text, extracting pages).
PDF Engine Dependency

The encryption strength (e.g., AES-256) depends on the configured PDF Engine (QPDF, pdfcpu, or PDFtk).

Check the PDF Engines Configuration to see which engine is active.

POST/forms/pdfengines/encrypt
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.
userPasswordstringrequired
The password required to open the PDF.
ownerPasswordstring
The password required to change permissions or edit the PDF.
filesfile[]required
PDF files to encrypt.
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/encrypt \
--form files=@/path/to/file.pdf \
--form userPassword=open \
--form ownerPassword=manage \
-o my.pdf
The encrypted PDF file.
Content-Disposition: attachment; filename={output-filename.pdf}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}