# [Tex/LaTex] How to run pdfcrop when using \includegraphics with a PDF

graphicspdfpdfcrop

This question is similar to that one, but I'd like to execute pdfcrop when including a PDF.

When the shell escape feature (--shell-escape or --enable-write18 (MiKTeX)) is enabled, the conversion can be called via \immediate\write18{...}:
\immediate\write18{pdfcrop image.pdf}%

\IfFileExists{image-crop.pdf}{}{\immediate\write18{pdfcrop image.pdf}}%