4

I'm attempting to use the npm package pdf-image (https://www.npmjs.com/package/pdf-image) for an app that is deployed on heroku. It requires imagemagick ghostscript poppler- (ensure you have convert, gs, and pdfinfo (part of poppler) commands).

I've attempted to add a imagemagick, ghostscript, and poppler buildpack to the app and then deploy. The app is working but times out (h12 heroku error) when it comes to the method that requires the pdf-image package.

The method works locally without problem.

I'm not sure how to trouble shoot. I see that there are a lot of different options to use for the buildpacks and am wondering if I added the best one or not.

Has anyone deployed to heroku with the pdf-image package? Which buildpacks do you recommend for ghostcript, imagemagick, and poppler? What are other possible causes for the time out and ways to troubleshoot?

Thank you!

Jamie Kook
  • 81
  • 5
  • It is possible that your Heroku environment cannot find Ghostscript when using Imagemagick. You can edit the Imagemagick delegates.xml file and add the full path to gs in the PDF entry. You may also need to edit the Imagemagick (security) policy.xml file to give permission to read PDF files. I do not know that either of these is your issue as I know little about Heroku, but these are common issue. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 for the latter. – fmw42 Feb 15 '20 at 00:34

1 Answers1

1

Depends on what heroku stack you're using.

https://github.com/Fieldwire/heroku-buildpack-poppler

This buildpack has worked for me on heroku-18 stack. You can find more buildpacks here .

Also you may check here if the library is not installed already on your server and what version. For example the imagemagick and ghostscript are already there since cedar-14 so you don't need to add that buildpack.

froston
  • 1,027
  • 1
  • 12
  • 24