Set userPassword to encrypt a PDF with 128-bit AES and require a password to open it, and use permissions to decide what a reader may do with the document.
Three parameters control encryption:
userPassword — the password a reader must enter to open the PDF. Setting it turns encryption on.ownerPassword — optional. Grants full access to the document, including the actions that permissions restricts.permissions — what a reader who opens the PDF with the user password may do. The default is ["print"].curl --fail --show-error --output example.pdf --request POST \
--url https://api.html2pdf.app/v1/generate \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <your-api-key>' \
--data '{
"html": "https://example.com",
"userPassword": "user",
"ownerPassword": "owner",
"permissions": ["print", "modify", "copy"]
}'The values permissions accepts are:
print — printing.printbest — high-resolution printing, when print is also allowed.modify — modifying the document, signing it and changing form fields.copy — copying content.edit — commenting.fillform — filling in form fields.extract — copying content for accessibility.assemble — rotating, inserting or deleting pages, and managing bookmarks and thumbnails.Encryption uses 128-bit AES. See Encryption in the documentation.