44

My questions is very simple. How can I set security setting for a PDF file created with PDFLatex?

I should set some password or print permissions, etc.

44

This answer, taken partially verbatim from Digital signature on TeX.SX:

Using the PDF Toolkit you can specify a separate owner and user password. Owner passwords are required when changing document properties, while user passwords may be required for performing certain actions, like printing. However, only specifying an owner password and allowing printing by default, would allow users of the document to view/read/print without authentication. You would need the following command line execution:

pdftk input.pdf output output.pdf owner_pw foo allow printing

The above commands takes as input input.pdf, sets the owner password to foo and would allow printing by any user. Modification of document settings require the owner password. See the documentation/man page and examples for more information.

  • 1
    Thank you very much for reply. I was useful for me, I am now using pdftk like my tool. But let me confirm one doubt... Is it no possible to add security with PdfLatex? – NeoRiddle Oct 14 '11 at 4:49
  • 4
    As far as I know, this is not possible directly. You need external software to encrypt the file. – Werner Oct 14 '11 at 4:54
4

As pdftk is no longer easily available for certain Linux distributions (or no longer easy to keep track of what is going on), another option is qpdf. Password protection is possible. The basic syntax is:

qpdf infile.pdf --encrypt <userpwd> <ownerpwd> <key length> [ restrictions ] outfile.pdf

Where,

  • one or both of <userpassword> and <ownerpassword> may be empty strings
  • key length may be 40, 128, or 256 and the higher the value the more restrictions one can impose on the use of the pdf.

For example,

  qpdf infile.pdf --encrypt usr own 128 --print=none -- outfile.pdf

should prevent unauthorized printing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.