1

I originally used TikZ for a lot of the diagrams I use for my tex file. However, as diagrams get more complicated (think insanely nested loops with labels everywhere) I find it is usually easier and way less time consuming to crop high quality pictures from PDFs

Here is my routine.

  1. I draw the diagram in power point, this way I get high quality diagram with white background

  2. I save the power point in PDF

  3. I use BRISS to crop the diagram out of the saved PDF, that creates a separate PDF of just the picture, then I insert it into the tex file

However, BRISS only works if your PDF is two pages...any more then there would be an error. Even if it is only two pages, there might be a problem where the entire second page magically gets attached to the cropped image. Needless to say there is some problem with the tool.

Does anyone know any other PDF cropping tool?

Fraïssé
  • 3,139
  • "Metafile to EPS" can help you. Look at this answer: http://tex.stackexchange.com/a/254705/1952 – Ignasi May 25 '16 at 06:58

1 Answers1

7

pdfcrop that is part of Tex Live, can crop multi-page pdf automatically, and create a new pdf with all the pages cropped. You can then simply use includgraphics to read each page, or read all pages at once. I do the cropping in makefile, which does all the pre-processing and then calls latex. But you can do it from inside Latex as well

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgffor}    
\usepackage{graphicx}    
\begin{document}

%call pdfcrop. Change location as needed.    
\immediate\write18{/usr/local/texlive/2015/bin/x86_64-linux/pdfcrop  ./images.pdf images-crop.pdf}
\pdfximage{images-crop.pdf}%all my cropped images are now here.

\foreach \n in {1,...,\the\pdflastximagepages} %loop over each page
{
    \fbox{%do whatever with the current page, caption, figure, etc...
        \includegraphics[page=\n]{images-crop}
    }

}
\end{document}

compile as pdflatex --shell-escape foo.tex

Nasser
  • 20,220