Merge pdf using pdftk

pdftk is a command line handy tool for manipulating PDF

usage example

pdftk 1.pdf 2.pdf 3.pdf 4.pdf 5.pdf 6.pdf 7.pdf cat output final.pdf

Remove pdf pages using pdftk

example discarding page 13 from in.pdf and producing out.pdf

pdftk in.pdf cat 1-12 14-end output out.pdf

Resize and scale using Ghostscript

gs or Ghostscript is a PostScript and PDF language interpreter and pre‐viewer

Usage example

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
# resolution info
# -dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
# -dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
# -dPDFSETTINGS=/printer  (high quality, 300 dpi images)
# -dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
# -dPDFSETTINGS=/default  (almost identical to /screen)

Change metadata

# install
sudo apt install libimage-exiftool-perl
# execute
exiftool -Title="my title" -Author="644.ovh" -Subject="my subject" <file_name.pdf>
Categories: Bash

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.