Generate PDF that is not editable

Solution 1:

The PDF Toolkit is a free, command line application that provides this functionality. You set the "owner password" (owner_pw <password>) and specify which properties are allowed for the document. Here's an example (from the Pdftk Examples page) that encrypts the document with 128-Bit Strength and allows printing only:

pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass allow printing

It yields the following Document Properties in Adobe:

enter image description here

Other permissions can be set as well (from the Pdftk Man page):

[ allow < permissions > ]

Permissions are applied to the output PDF only if an encryption strength is specified or an owner or user password is given. If permissions are not specified, they default to ’none,’ which means all of the following features are disabled.

The permissions section can include one or more of the following features:

  • Printing – Top Quality Printing
  • DegradedPrinting – Lower Quality Printing
  • ModifyContents – Also allows Assembly
  • Assembly
  • CopyContents – Also allows ScreenReaders
  • ScreenReaders
  • ModifyAnnotations – Also allows FillIn
  • FillIn
  • AllFeatures – Allows the user to perform all of the above, and top quality printing.

As it turns out, these security features is very much viewer dependent and there are ways around it.

Solution 2:

I will add this as an answer, because it answers the question somehow and it is long and a bit complicated. The short answer is: no, it is not possible. Once you can read the PDF on your screen, it means that there's all the information and the PDF can be edited. Adobe programs of course do not offer such functionality. But if you want the PDF to be editable, you can always use ImageMagick:

convert -density 600 myfile.pdf myfile.png

Afterwards, since the quality is very high, any sufficiently good OCR will be able to convert it back to text. And there are surely other possibilites. As was mentioned by the other people, you can decode the PDF to PS (which is possible because to some extent, this is what the PDF reader has to do) and then convert back, and you have an editable PDF file.

Conclusion: You can protect the PDF from edits by "normal" users, but you cannot protect it from edits by people who know what they are doing.