Flávio Lúcio Na... · Jun 25, 2021

PDF with Password

Hello Everyone,


I have a question, someone know how to put a password in a pdf file? Or in a pdf base64?


Best regards, Flávio.

0 197
Discussion (4)2
Log in or sign up to continue

Do you need the eventual user to be prompted for a password when opening the PDF? If so, you'll need to push it through an external application/utility (under IRIS/Cache control) that supports command-line password protection for the output file.

If you just need to encrypt the file for delivery but don't need the user to be prompted for a password when opening the document, there are a number of encryption options in the %SYSTEM.Encryption class.

The tools for doing this will vary by platform, but a utility called qpdf supports your needs for most modern Unix/Linux variants. You would call it from ObjectScript using the $ZF(-100) function.

You can use pdfbox which is already used by ZEN for some pdf conversions. To make a pdf require a password, just run this command with $ZF(-100):
java -cp /opt/cachesys/fop/lib/pdfbox-app-1_7_1.jar org.apache.pdfbox.Encrypt -U 12345 /arquivos/file.pdf