so I have building management app, which locally uses the pdftk to generate pdf forms (prefilled with tenant/expense data). Works like magic on my local machine. However, on Heroku I get the error:
pdftk executable /usr/local/bin/pdftk not found
in the logs when I try to generate the pdf file. I realize that I need to install pdftk on my heroku app using a buildpack. I've tried following some tutorials with Vulcan, but vulcan is deprecated and they say use heroku run, however I can't find much documentation of how to install the pdftk-source: https://github.com/millie/pdftk-source using heroku run.
I'm going to try https://github.com/millie/heroku-buildpack-ruby-pdftk, but if there is an easier/less messy way let me know, thanks!
EDIT: Tried the above method, and now my heroku logs say: RuntimeError (pdftk executable /app/vendor/pdftk/bin not found) So I'm thinking the buildpack didn't include pdftk to begin with, which doesn't make sense. I must be doing something wrong, but I followed the instructions exactly, only difference is I used dropbox instead of S3 to store the tar.gz file (the pdftk source)
EDIT: OK, I figured out how to include pdftk executable in the heroku buildpack and upload it successfully as part of the app environment. HOWEVER, for some very strange reason, in the heroku bash console, when I cd into pdftk directory and try to run the executable, heroku bash says pdftk executable not found.
It works on my local machine, when cd into the pdftk directory and run pdftk, it runs the executable, so its not the executable..so why isn't it working inside the heroku bash directory?
SOLUTION: Was missing setting LD_LIBRARY_PATH in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk. Just check out #heroku on IRC, that's where I got my answer.
Was missing setting LD_LIBRARY_PATH
in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk
. Just check out #heroku on IRC, that's where I got my answer.