I suppose that your goal is to make it more difficult to select and copy text from a PDF. Because that is the only achievable goal you can put up. (If there is a way to see the PDF pages on screen, then there is a way to somehow get access to the text or image contents, albeit a more difficult one than just to copy'n'paste... I guess you are aware of that.)
You have three options:
- Convert your PDF pages to full-page pixel images and wrap these images again into a multi-page PDF.
- Convert the glyphs of all embedded fonts into vector outlines.
- "Encrypt" your PDF with a user password.
Each of these 3 methods is very easy to apply, given the right tool. :-)
For each of these methods you can use a Free and Open Source Software tool on the command line. (Each of these tools is available for Linux, Mac OSX, Unix or Windows.)
See the more detailed discussion fore each method following below.
1. Create Full-Page Pixel Images (Using ImageMagick's
You can use ImageMagick's
convert command simply like this:
ImageMagick can directly only work with raster images, not with any other format. Since it cannot process PDFs directly, it will automatically employ Ghostscript as its delegate. Hence Ghostscript needs to be installed too! Ghostscript will create the raster images needed as input by ImageMagick.
You can observe the process of ImageMagick using Ghostscript as a background process by adding
-verbose switch to your command line.
convert will use a resolution of 72ppi. This may be not good enough for reading well (but it will be much more difficult to circumvent your 'protection' by applying OCR software to the output.)
Above image shows a screenshot of a pixelized PDF page created with the default resolution (72 PPI) used by ImageMagick at 600% zooming level. If you need a better resolution, say 200 PPI, add the
-density 200 parameter to the command line:
-density 200 \
Above image shows the shot (also at 600% zooming level) of a pixelized PDF page created by ImageMagick with higher resolution of 200 PPI.
Note, when I tested the above command with the default resolution of 72 PPI, a 219-page PDF with all text and a size of 1 MByte resulted in a 23 MByte output file. It took about 2 minutes to generate on a MacBook. The 200ppi PDF resulted in 110 MByte and took 11 minutes to be ready...
It is easy to circumvent pixelization of pages if the resolution is good enough: OCR will work just fine. With a low resolution it may still be readable (and guessable) for humans, but difficult for machines to come up with good OCR results.
2. Convert All Glyphs to Vector Outlines (Using Ghostscript)
You can use the newest and latest and greatest release of Ghostscript. That is version v9.15. Check your installed version with
The newest version v9.15 includes a new command line parameter,
--dNoOutputFonts. This parameter will convert all glyph shapes into outlines and remove all the embedded fonts:
-o pdf-with-outlines.pdf \
In my test, the same 219 page PDF (with a size of 1 MByte) converted into an output file of 186 MByte, taking 6 minutes to convert.
The advantage of outlines is that the page's text remains clear and sharp and un-pixelated, and you can zoom into the text at any level without loosing sharpness. You can see this in the next screenshot:
The disadvantage is the file's size. (BTW, I tested the same method, converting text to outlines, with Adobe Acrobat Pro XI, and the resulting file size was 61 MByte, taking 15 minutes of processing.)
It is easy to circumvent this measure: OCR will work just fine.
3. Protect PDF by 'encrypting' it (Using
What is not so well known, is that you can 'protect' or ('encrypt') a PDF with empty passwords (the 'user' as well as the 'owner' passwords). This allows all PDF reader/viewer software to open the file without asking for a password, only popping up the password dialog when trying to copy text from a page or when trying to print the file.
QPDF has quite good support for this:
--encrypt "" "" 40 \
What do all these command options mean?
--encrypt "" "" 40:
This sets both passwords (user and owner) to the empty string and the key length to 40 bits.
This disables printing of the PDF.
This disables modification of the PDF.
This disables text and image extraction of the PDF.
This is required to signal the end of encryption options.
There are more (and different) detailed options available with QPDF if you use a 128 or 256 bit keylength.
Other available options include
--modify=[annotate|form|assembly] which would allow the filling of forms, adding of annotations or assembling the document with other PDFs (while at the same time still disallowing copy'n'paste or print).
qpdf --show-encryption crypt.pdf
Will show the details about any file's 'encryption' settings. Example:
extract for accessibility: not allowed
extract for any purpose: not allowed
print low resolution: not allowed
print high resolution: not allowed
modify document assembly: not allowed
modify forms: allowed
modify annotations: allowed
modify other: not allowed
modify anything: not allowed
BTW: Leaving the password empty in the two dialogs shown above will not help with (most? or all? haven't tested...) PDF viewers. It still won't unlock to copy or print.
The advantage of this method lies in its fast execution and its almost identical file size.
Of course, it is just as easy to remove the 'encryption' again:
qpdf --decrypt crypted.pdf decrypted.pdf
For fast results, identical file sizes, and easy-to-remove protection against 'casual' selection and copying of text, use 'protection'/'encryption' with an empty password.
For slow results, and potentially huge file sizes (but not always good looking pages) and a bit more-work-to-remove-the-protection, use pixelization for all pages.
For even slower results (but always better looking pages) and also more-work-to-remove-the-protection, use the vector outlining method of all text.
Always be aware, that all these methods do not absolutely protect the contents of your PDF pages. They only make it more inconvenient to extract.