Graphics, Figures & TablesAutomatically crop PDF to visible text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
MalcolmWardlaw
Posts: 1
Joined: Wed Feb 16, 2011 8:04 pm

Automatically crop PDF to visible text

Post by MalcolmWardlaw »

I built a small shell script using some latex tools for the purpose of reformatting certain irregular PDF documents.

I was wondering if there was any technique that has been developed to automatically crop a pdf image to its visible text. Essentially, I have a number of pages that have visible text with a large amount of white space around them. The amount of existing white space varies, so I was hoping that there was some way to script the cropping dimensions to automatically trim the white space up to the smallest possible rectangle.

Has anyone done this or seen it done? If not would anyone have any suggestions on the best way to script this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Automatically crop PDF to visible text

Post by frabjous »

Here are two suggestions:
  • The pdfcrop perl script, which is on CTAN, and quite possibly already installed as part of your LaTeX installation.
  • Another script making use of a combination of Ghostscript and calibre. Details here.
(I actually know of some other tools out there that do this if these don't work for you.)

You may also be able to accomplish what you want with the preview package, but it's unclear from your description.
Post Reply