I have another device, an eInk ebook reader (Onyx Boox), that has this wonderful feature, "auto-crop", that auto-detects the white margins in pdf (with a given degree of "aggression"), and zooms out it.

Sometimes, at night, I prefer to use my notebook to read ebooks. This option would make the experience much better, but so far I can't find this feature in any PDF software I've tried.

How do you read PDFs that "auto-crop" the white margins on a Linux system?

I'm not interested in permanently removing the white space out of PDFs; just hiding it for sake of a reading session.


Not really, and not all kinds of PDFs (that at least is my experience: the closest I got was, if memory serves, FoxIt Reader). I usually go a more radical way and crop the PDFs at the source using tools such as PDFquench, or PDFcrop; I too used to read them on a Onyx A60 (also tried annotating them and reading back with Okular), before switching to a rooted PRS-T1.

It would perhaps be possible to create a script to get a PDF, make a cropped copy of it, and run a plain old PDF viewer on the copy, deleting it upon closure.

  • That's bad news. I'll wait a moment and then I'll try to make such script. It shouldn't be that difficult. Jun 10 '13 at 5:52
  • 1
    I've tried myself, and the linked PDFcrop utility seems to have problems with zero-sized BBoxes. The pdfcrop I use turned out to be a script by one Heiko Oberdiek, with the --pagesize and --margins options. Note that, depending on the PDF, the output size may increase considerably.
    – LSerni
    Jun 10 '13 at 6:53
  • I understand, that the PDFcrop doesn't provide option for "fuziness" of the cropping (like the pdf reader for Onyx does), so if the PDF have a header/footer far away from the text, it still always includes it, right? Jun 10 '13 at 7:46
  • Yes... I've been bitten by the script bug :-), so I am too being experimenting with cropping (I usually did it visually, but having a script catches my fancy). pdftk allows uncompressing the PDF and exposing the MediaBox, now I'm thinking of counting all the objects with their coordinates, and build a "heat map"...
    – LSerni
    Jun 10 '13 at 7:51
  • 1
    I've been playing with the iText library in Java. I've now a nifty little framework to trim a PDF in (mostly) any way I decide. Could I perhaps interest you in being a beta tester? :-)
    – LSerni
    Jun 13 '13 at 20:10

I use Okular on Ubuntu. It has a simple option to trim margins - exactly what you are looking for :-)

  • I have tested Okular and it has a "Trim View" on menu View/ Trim View / Trim margins that really works, but, unfortunately, it doesn't export that view to another PDF file.
    – Arpatma
    May 25 '17 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.