1

On one of our local servers, I use pdftoppm (v 0.18.4) to capture the first page of a pdf file as a 1200px wide jpg. It's very quick, and works very well. I'm doing it like so:

pdftoppm -f 1 -l 1 -scale-to-x 1200 -jpeg "$infile" "$outfile"

This is practically instantaneous in its execution.

On our live server, we have a more modern version of pdftoppm (v 3.00) and it takes a long time (between 30-70 seconds) to produce the thumbnail, which I'm doing like so:

pdftoppm -f 1 -l 1 -r 1200  "$infile" "$outfile"

This took 35 seconds and produced a 400 MB image which was nearly 10,000 px wide, so that's obviously not correct! I can't seem to be able to control the resolution (which is obviously the source of the huge file size and conversion time), and I can't seem to be able to specify that the output is a jpg either: passing the -jpeg option just makes pdftoppm output its options, which is the standard behaviour for "bad options given".

Can anyone tell me which options to pass to v 3.00 to get the same result as with the earlier version?

I think I should actually just try and downgrade our server version of pdftoppm to the same one I have locally, but before I do that I want to see if I'm missing something. The man page for v3.00 is here: http://linux.die.net/man/1/pdftoppm

0

I just experience this issue so I think I can contribute a little bit here. If you look at the document of pdftoppm, you will notice in the live server you are actually not scaling to 1200px, rather, you are setting the resolution to 1200 (default is 150) which explain the long processing time needed on your live server

    pdftoppm -f 1 -l 1 -r 1200  "$infile" "$outfile"

should be change to

    pdftoppm -f 1 -l 1 -scale-to 1200  "$infile" "$outfile"

instead which should provide you with the same speed as your dev server.

  • Ah - so i'd been setting it to 1200 pixels-per-inch? That would explain the slowness! Thanks - i will try this. – Max Williams Mar 30 '16 at 14:41
  • @MaxWilliams if this is the answer, please vote it as answer. thanks – cylua2 Mar 31 '16 at 18:53
  • I've not had a chance to test it yet but if it works then i'll mark it as correct. thanks – Max Williams Apr 1 '16 at 12:18
  • @MaxWilliams yes sir ;) – cylua2 Apr 2 '16 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.