I need to make a PDF uneditable and a good way to accomplish that is to use the "Print to file" functionality in most PDF readers to generate another PDF. I suppose they work by converting the PDF to images and then embedding those images into another PDF.

I need to accomplish the above from the command line, but I haven't found an option that retains the quality. I tried the following:

  1. convert -quality 100 -density 600 input.pdf output.pdf
  2. pdf2ps input.pdf - | ps2pdf - output.pdf

Both options generate a blurry PDF. I am not sure why, since the input PDF only contains text and a bar code. Option 2) is definitely better, but it still affects the barcode slightly.

By comparison, using the "Print to file" functionality in Evince produces a PDF that is almost exactly like the original one, and it's also faster. I also tried pdftk but it produced an editable PDF.

How can I accomplish what Evince does from the command line?

Note: my PDFs contain notes (or "stamps") too, and they don't have to be editable (e.g. with Adobe Acrobat) afterwards. The two solutions I outlined above work in this regard, whereas pdftk produces a PDF in which the stamps can be edited.

  • You can't actually make a PDF "uneditable", at most you can make it slightly difficult - too hard for a 5 year-old, perhaps, but not for anyone much older than that. Anything you do can be reverted by someone determined enough, using the same kinds of tools you want to use, and it's not even particularly difficult or time-consuming to do so. Even the plain text can be restored with, e.g., ocrmypdf and tesseract-ocr. This is true even for PDFs made with Evince.
    – cas
    Aug 12, 2021 at 15:26
  • @cas Yes, that is fine. Maybe "uneditable" wasn't the right description. I just want to remove the ability to manipulate PDF objects, so I think converting to an image is the only solution.
    – rubik
    Aug 12, 2021 at 15:33

1 Answer 1


Try pdftoppm of poppler.

pdftoppm -aa yes -aaVector yes -png ./input.pdf ./out && convert ./out-*.png ./output.pdf

It extracts all pages as png (you can also output ppm, jpg and tiff) and convert them to another pdf. The flags -aa and -aaVector are for font and vector ant-aliasing. There are some other flags like FreeType font rasterization, thin line mode, I don't know how they can come handy, you can check tweaking them too.

Evince requires poppler-glib, so it might use the poppler library to do 'Print to file` operation.

  • Thanks. Unfortunately the quality with this is worse than method number 2). I also tried with convert -quality 100 but it does not improve.
    – rubik
    Aug 12, 2021 at 17:42
  • @rubik, I suggested this method because it allows selecting DPI/PPI,whatever it's called. Set higher value until you reach prefered quality. Aug 14, 2021 at 0:26
  • I tried that, but if I increase the density with convert the resulting PDF is very small.
    – rubik
    Aug 14, 2021 at 8:00
  • @rubik No, I mean the density of png/ppm/tif, before convert. Aug 14, 2021 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .