1

I am on Windows 10, with pdfcrop 1.40 installed. For some figures, pdfcrop works fine, but not for others.

For figures like this one it does not crop anything: Figure for which pdfcrop does not crop anything

While for figures like this one, it crops too much:

Non-cropped figure: Non-cropped figure Cropped figure: Cropped figure

Any idea how to make pdfcrop work fine?

bixiou
  • 73

1 Answers1

1

Sometimes something like invisible lines cause wrong cropping. Sometimes BoundingBox information in the PDF cause wrong cropping. pdfcrop has extra options, to fix such PDFs manually. E.g. for the first image you can use:

pdfcrop --bbox "23 52 396 242" Heatplot_global_tax_attitudes_GCS_positive.pdf

to reduce the size.

The second image seems to be cropped already. So you don't need to run pdfcrop. But if I use

pdfcrop belief_mean-crop.pdf

I get the same size as the original PDF. So it seems to be correct.

However, you could experiment with options --margins and --noclip to increase the cropping result again.

BTW: The result of pdfcrop also depends on ghostscript. So if the syntax of ghostscript changes a lot, the pdfcrop also could break. I'm currently using ghostscript version 9.56.1.

cabohah
  • 11,455
  • Thank you. For the first one, I'd like to find a solution that does not rely on customizing the parameters manually, if possible. For the second, I attached the wrong link (it is now corrected). Indeed, meanwhile I had a friend of mine running pdfcrop so that it works fine (for him it works but not for me). In a nutshell, the problem remains. How do you find your ghostscript version? – bixiou Feb 23 '23 at 16:44
  • 1
    @bixiou run ghostscript option --version only to get the version. – cabohah Feb 23 '23 at 17:35
  • OK. Ghostscript is not in my path, can this cause the bug? I found it in C:\texlive\2022\tlpkg\tlgs\bin\ and C:\Users[name]\AppData\Local\LyX 2.3\ghostscript\bin (running gswin64c --version in these folders show that my version is 9.56.1). – bixiou Feb 23 '23 at 17:54
  • Btw, my friend for whom it works is on Mac OS, with GhostScript version 9.55. – bixiou Feb 23 '23 at 18:04