Non-editable pdf

2,070 views
Skip to first unread message

Marek

unread,
Nov 30, 2011, 3:48:47 PM11/30/11
to dompdf-dev
Hello.

Is it possible to generate non-editable pdf with domPDF?

Best Regards,
Marek

BrianS

unread,
Dec 22, 2011, 2:54:48 PM12/22/11
to dompd...@googlegroups.com
You can use the underlying CPDF engine to specify what the user can do with the document. Per the CPDF documentation:

Calling [the setEncryption()] function sets up the document to be encrypted, this is the only way to mark the document so that they user cannot use cut and paste, or printing.

Using the call without options, defaults to preventing the user from cut & paste or printing. There are no passwords require to open the document.

Setting either off the passwords will mean that the user will have to enter a password to open the document. If the owner password is entered when the document is opened then the user will be able to print etc. If the two passwords are set to be the same (or the owner password is left blank) then there is no owner password, and the document  cannot be opened in the accesible mode.

The pc array can be used to allow specific actions. The following example, sets an owner password, a user password, and allows printing and cut & paste.

$pdf->setEncryption('trees','frogs',array('copy','print'));

Using the above example, with dompdf you would first render the document, then issue something along the lines of the following:

$dompdf->get_canvas()->get_cpdf()->setEncryption('trees','frogs',array('copy','print'));

Also, please post help requests to the support forum: https://groups.google.com/forum/#!forum/dompdf. This forum is for developer discussion not for general support.
Reply all
Reply to author
Forward
0 new messages