PDF manipulation
Combine images into a PDF file
Fist install ImageMagick ( pacman -S imagemagick
on Arch Linux )
$ convert image1.jpg image2.jpg image3.jpg out.pdf
Compress a PDF file
Fist install the ghostscript utility ( pacman -S ghostscript
on Arch Linux )
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf in.pdf
Note: The compression factor can be adjusted with the -dPDFSETTINGS
parameter like this:
- /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
- /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
- /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
- /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
- /default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.
Encrypt / Decrypt PDF files
Fist install qpdf ( pacman -S qpdf
on Arch Linux )
$ qpdf --password=pdf_password --decrypt password-protected.pdf out.pdf
$ qpdf --encrypt user_password pdf_password key_length -- in.pdf out.pdf
Extract pages from PDF file
Fist install qpdf ( pacman -S qpdf
on Arch Linux )
$ qpdf --empty --pages in.pdf first-last -- out.pdf
Combine multiple PDF files
Fist install qpdf ( pacman -S qpdf
on Arch Linux )
$ qpdf --empty --pages first.pdf second.pdf third.pdf -- out.pdf
Comments