Forum How do I...?

PDF export options

spjonez
http://www.princexml.com/doc/command-line/#command-line

I see there are options to prevent users from editing a PDF that was generated but they are all subsets of the encryption setting. Is there a way to disable editing without requiring a password to open the document?

We'd also like to flag documents as signed after we inject a signature into a completed document. Some companies like DocuSign show a popup when the PDF is opened. Can this be done in Prince? How?

Cheers!
mikeday
The PDF will be encrypted if you disable editing, but a password will not be required to open the document unless you specify the user password option.

Prince does not support signed PDFs yet, this must be done with another tool.
spjonez
I'm using the PHP wrapper, how do I disable editing without using a password?

I've tried:

$prince->setEncrypt( true );
$prince->setEncryptInfo( 128, null, null, false, true );

$prince->setEncrypt( true );
$prince->encryptInfo = ' --disallow-modify ';

$prince->setOptions( ' --disallow-modify ' );

And none of them seem to disable editing? The first and third show a PW prompt and clicking ok lets you open the document. The second doesn't seem to do anything.

Some other things I've tried:

$prince->setOptions( ' --encrypt --disallow-modify ' );

[edit]

This works in Adobe Acrobat:

$prince->setOptions( ' --encrypt --key-bits 128 --owner-password=test --disallow-modify ' );

Edited by spjonez

mikeday
Running from the command-line the --disallow-modify option is sufficient, and will imply the --encrypt option and not require a password to open the PDF file.

From the PHP wrapper you can call setEncryptInfo(), which also has the effect of implying setEncrypt(true). I would suggest passing empty string for the user and owner passwords.

Please note that PDF viewers may differ in how they treat encrypted PDF files. In particular, MacOS X Preview and Firefox PDF.js viewer are unfortunately riddled with bugs, so it helps to check in Acrobat first.