[Tex/LaTex] Install and use pdfcrop on windows

pdfcrop

first of all I have to admit I'm definitely not an expext with tex stuffes ; I have found several post related to perl script not working with latex but I can't figure out what is happening on my computer.

So, I try to use pdfcrop https://www.ctan.org/pkg/pdfcrop. I downloaded the pdfrcrop.pl file but the documentation for windows was pretty blurry to me.

I have been able to run perl pdfcrop.pl and now I have :

  • MikTex\miktex\bin\x64\pdfcrop.exe
  • MikTex\scrips\pdfcrop\pdfcrop.pl
  • MikTex\tex\latex\scrips\pdfcrop\pdfcrop.pl

When I type in the command prompt:

  • pdfcrop –version, I get: pdfcrop 2012/11/02 v1.38
  • perl –version, I get This is perl 5, version 22, subversion 0 <v5.22.0> ...

Now I am using pdfcrop through knitr and I get the error message :

cropping figure/pyfig.pdf
pdfcrop: The Perl interpreter could not be found.

When I try to run directely pdfcrop in the Terminal, it stops at the second steps:

*Copy input file to temporary file
!!!Error copy failed, <No such file or directory/Access denied>

Thanks a lot for the help !

Best Answer

You need first to install Perl support for Windows (for example https://www.activestate.com/activeperl) and after that use Miktex package manager to install pdfcrop.

Then you should be able to use command pdfcrop on Windows Powershell or Command prompt.