Home » Blog » Manipulate pdf files with Ghostscript
Manipulate pdf files with Ghostscript
Crop
This may be useful when the margins of the pdf files are too large, e.g. for printing or displaying in a tablet device. See this post.
Merge
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdffile1.pdf file2.pdf
-dBATCH: exit after last file, otherwise GhostScript will keep running. -dNOPUASE: no pause after each page, otherwise GhostScript will pause for user interaction after each page. -q: quiet, fewer messages.
Split
Change page size
gs -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dPDFFitPage -o output.pdf input.pdf
595×842 is the standard A4 size.