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:
convert -quality 100 -density 600 input.pdf output.pdfpdf2ps 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.