Usually, I'm pretty happy using pdfcrop
, even though the cropped output usually consumes significantly more disk space. Note that comparable code does exist, which addresses and resolves this issue. However, if wanting to crop a scanned (image) pdf file, my impression is that pdfcrop
simply fails. I imagine that ImageMagick
is capable of doing the trick, possibly by (also) making us of pdftk
.
I'm looking for an efficient one-liner of code (a multi-line script would also be ok...) to crop such a pdf file from Top-Bottom-Left-and-Right by x cm each (or, better yet, by a b c d cm, individually), going all the way from input.pdf to output.pdf.
ps: the solution needn't involve ImageMagick
; I'm happy as long as it works (cleanly, reliably and efficiently)... ;)
You could try briss. It's pretty simple, but does the job. It's a GUI app though.
Download the zip file and extract to a folder of your choice and start it:
To install it permanently and system-wide and be able to start it from anywhere with just
briss
, you would unpack the download in/usr/local/lib/
, then create an executable file/usr/local/bin/briss
that contains:This here is the best and easiest and has a wonderful GUI: Krop
Download deb from the author: http://arminstraub.com/computer/krop
Review: http://www.hecticgeek.com/2013/08/crop-pdf-ubuntu-13-04-krop/
Edit: I am using krop since 13.10 and I noticed that the latest versions started to support opening a pdf with krop via right click. I also switched to the snap version since it became available and it supports also right click, confirmed on 18.10 - 20.04. The GUI is not as colorful with the snap version but functionality is the same:
Full credit is due to AlexG who incidentally en passant posted a solution to this problem here, which, for completeness sake and so it doesn't get lost (!), I quote below.
Relevant to the above question is the trimming option described in the
man
: