I have a PDF that I want to show to someone without giving them the ability to copy it. One possible way would be to convert pages to images, then these back into a PDF. How can I use
pdftk or otherwise script? Not GUI.
Imagemagick rasterizes everything. You could simply do:
convert -density 200 input.pdf output.pdf
Of course the recipient might decide to run an OCR program on your file. The
density parameter sets the resolution expressed as PPI.
PDF to Image
poppler-utils packages includes the
pdftoppm utility, capable of converting
pdftoppm -png file.pdf prefix
This will make files name
X is the page number (each file outputted will be one page of the
extension is whatever output type you choose.
By default the resolution is 150dpi. You can increase the resolution (for higher quality output) by using this command:
pdftoppm -rx 300 -ry 300 -extension file.pdf prefix
And to print only one page, do:
pdftoppm -f N -singlefile -extension file.pdf prefix
N is the page number, starting with 1.
This method is a lot faster and less clunky than using the
imagemagick package as mentioned in other posts. Although you do have to use it to convert back.
This requires the installation of the
imagemagick package. To do this, do:
sudo apt-get install imagemagick
imagemagick package has a utility called
convert which will do just as it is named; convert. To make use of it in the way that you want, run it like so:
convert file.extension file.pdf
This will make a
convert *.extension file.pdf
This will grab all files in the directory that you are in with the
extension extension and convert them into a
I chose to format my answer in the way of two separate commands as to give the OP flexibility and understanding of the task that they are trying to complete, instead of one command linking the two. Of course, if that solution is better for them, then I encourage them to upvote/mark as answered that particular answer.
I always use pdftoppm to convert pdf to png images. simply execute the following command
pdftoppm -f [startpage] -l [end page] -r [resolution (use 300 or 600) -png <pdf file location> [Prefix for your image files]
and then execute
convert prefix-[number].png file.pdf
but there are programs that convert these images back into text. making your pdf uncopyable is very hard. You could add an encryption protection to prevent copying and printing which will make is (slightly) more difficult to copy and print your pdf file