in reply to Re: Protect PDF from printing
in thread Protect PDF from printing

No luck - Here's what happens

This attempt protects from printing, but there's no password assigned, so printing can easily be turned on:

rewritepdf.pl --prefs 0 0 0 0 file.pdf file1.pdf

This attempt password protects printing -- but also requires a password to open the pdf:

rewritepdf.pl -p password password --prefs 0 0 0 0 file.pdf file1.pdf

This attempt password protects printing -- but the pdf only displays blank pages -- it erases the content:

rewritepdf.pl -p password --prefs 0 0 0 0 file.pdf file1.pdf

I've tried different PDF documents/pdf versions, but all documents end up blank

Replies are listed 'Best First'.
Re^3: Protect PDF from printing
by gachunt (Initiate) on Sep 27, 2015 at 01:33 UTC

    I went with using ghostscript instead

    For those who want to do something similar, execute this from your script:

    "C:\Program Files\gs\gs9.16\bin\gswin64c" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOwnerPassword=password -dPermissions=-64 -sOutputFile=\BICRwatch\protected.pdf \BICRwatch\file.pdf

    Here's the command explained:

    -dNOPAUSE stops ghostscript from asking questions during the process

    -dBATCH quits ghostscript after protection is applied

    dPermissions=-64 sets permissions to not allow any printing, editing, copying

    The rest should be self-explantory to edit.