-
poppler-utilspackage:apt install poppler-utils
-
pdfuniteto combine PDFs into one filepdfunite file1.pdf file2.pdf file3.pdf output.pdf
-
pdfseparateto pull out a range of pages, with one file per pagepdfseparate -f 2 -l 10 input.pdf output%d.pdf
Alternatively,
pdftkto pull out selected set of pages (for example to delete a page):pdftk input.pdf cat 1-2 4-end output output.pdf
-
Use
gsto reduce file sizegs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \ -dPDFSETTINGS=/printer -sOutputFile=output.pdf input.pdf
For
PDFSETTINGSyou can use/screen,/ebook,/printer, or/prepress. -
To install pdftk with Ubuntu 18.04 (Bionic), needed to do the following:
#!/bin/bash
##############################################################################
cd /tmp
wget http://launchpadlibrarian.net/340410966/libgcj17_6.4.0-8ubuntu1_amd64.deb
http://launchpadlibrarian.net/337429932/libgcj-common_6.4-3ubuntu1_all.deb
https://launchpad.net/ubuntu/+source/pdftk/2.02-4build1/+build/10581759/+files/pdftk_2.02-4build1_amd64.deb
https://launchpad.net/ubuntu/+source/pdftk/2.02-4build1/+build/10581759/+files/pdftk-dbg_2.02-4build1_amd64.deb
echo -e "Packages for pdftk downloaded\n\n"
echo -e "\n\n Installing pdftk: \n\n"
sudo apt-get install ./libgcj17_6.4.0-8ubuntu1_amd64.deb
./libgcj-common_6.4-3ubuntu1_all.deb
./pdftk_2.02-4build1_amd64.deb
./pdftk-dbg_2.02-4build1_amd64.deb
echo -e "\n\n pdftk installed\n"
echo -e " try it in shell with: > pdftk \n"
rm ./libgcj17_6.4.0-8ubuntu1_amd64.deb rm ./libgcj-common_6.4-3ubuntu1_all.deb rm ./pdftk_2.02-4build1_amd64.deb rm ./pdftk-dbg_2.02-4build1_amd64.deb
To run this script, copy it in an editor and save it e.g. pdftk_installer. Then run it in a terminal with
```shell
chmod 755 pdftk_installer
./pdftk_installer
-
Rotate pdf 90 degrees counter-clockwise with pdftk:
pdftk input.pdf cat 1west output output.pdf