(similar question exists, is explicitly for another platform and doesn't mention that no OCR is needed)
I need a command line tool (or a PDF viewer which supports this as a display option) which can remove the white border of a pdf file. No OCR or anything, just perfectly white borders. The input PDF files are vector graphics, i.e. white is always perfectly white. Ideally the output files would also be vector graphics/pdf so as not to waste disk space and so I can still zoom.
It needs to be a command line tool which supports at least Linux.
In a similar question this is an answer for Imagemagick:
From the formats page:
PDF - RW - Portable Document Format: Requires [Ghostscript] to read. By default, ImageMagick sets the page size to the MediaBox. Some PDF files, however, have a CropBox or TrimBox that is smaller than the MediaBox and may include white space, registration or cutting marks outside the CropBox or TrimBox. To force ImageMagick to use the CropBox or TrimBox rather than the MediaBox, use -define (e.g. -define pdf:use-cropbox=true or -define pdf:use-trimbox=true). Use -density to improve the appearance of your PDF rendering (e.g. -density 300x300). Use -alpha remove to remove transparency. To specify direct conversion from Postscript to PDF, use -define delegate:bimodel=true. Use -define pdf:fit-page=true to scale to the page size.
Well, I can't get it to work, neither
convert input.pdf -define pdf:use-trimbox=true output.png
nor the command with "cropbox" removes the borders of a standard LaTeX generated .pdf file.
Rationale: My use case is documents/books which are typeset in LaTeX. No, I don't have the source and it's not practical to get it. The (large) white border is nice and all when printing. But when working with a pdf file on a 10" netbook then space is precious and zooming past the borders can make the difference between being able to read small print (in formulas, exponents, indices, etc.) comfortably or hardly at all (I can also just use half of the screen for the pdf because those are mostly university assignments where I need to see exercise and my solution so far at the same time or compare something with a text book, stuff like that).