This repo is just to organize some info about pdf handling with Linux, such as merging, compressing, splitting, and other useful functionalities.
Compress bash file is credited to alfredklomp. This guys automates ghostscript
.
- Do not forget to make
chmod +x shrinkpdf.sh
before using it. - Typical usage:
./shrinkpdf.sh in.pdf > out.pdf
or./shrinkpdf.sh in.pdf out.pdf
- For choosing desired output dpi:
./shrinkpdf.sh in.pdf out.pdf 90
(72 is the defaultand is way too shrinky).
This uses pdfunite
which is part of poppler
and is probably already installed in your Linux.
Just use: pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf
To select all the files in one folder in numerical/alphabetical order, use: pdfunite $(ls *.pdf | sort -n) output.pdf
. Make sure you don't have white spaces in the file name.
pdfseparate -f 1 -l 5 input.pdf output-page-%d.pdf
Where -f
is the first page to split and -l
is the last one. If you want just one, make both the same. Also, %d
is important.
Use pdfjam
where the commands to rotate and the final is a landscape are:
pdfjam --landscape --angle 90 input.pdf
If you want the final to be a portrait, just remove the --landscape
command: pdfjam --angle 90 input.pdf