Sunday, December 26, 2010

Merging and encrypting PDF with Ghostscript

Recently I needed to merge several PDF files into a single file and also encrypt it. So after some googling, here my recipe:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOwnerPassword=password1 -sUserPassword=password2 -dKeyLength=128 -dEncryptionR=3 -sOutputFile=output.pdf input1.pdf input2.pdf input3.pdf


No comments: