I need to convert PDF to PNG on heroku, i'm using RMagick and for some PDF i run into this error :
Ghostscript 8.628.62: : Unrecoverable error, exit code 1 Unrecoverable
The same code runs fine on my local machine using Ghostscript 9.05
I would like to update the version of Ghostscript being used on Heroku and see if that solves the problem.
I followed these instruction to build ghostscript 9.05 on heroku :
http://theprogrammingbutler.com/blog/archives/2011/07/28/running-pdftotext-on-heroku/
My problem is vendoring the resulting package, how can i tell heroku to use my custom version of ghostscript instead of the system one ?
Here is what i tried :
Add the gs package under vendor/ghostscript/bin
Add it to the heroku path : heroku config:add PATH=vendor/ghostscript/bin:/usr/bin:/bin
My app still run on GS 8.62
Any help would be greatly appreciated !
Here are some ressources i tried to follow without success ...
https://devcenter.heroku.com/articles/buildpack-binaries
http://www.ryandaigle.com/a/using-vulcan-to-build-binary-dependencies-on-heroku
Related
I use "carrierwave" to upload and play video on website. It requires ffmpeg and ffmpegthumbnailer so I also set them up. Everything work well on local but then it fails when I try to repeat on Heroku.
The error messages are shown below:
File Failed to thumbnail with ffmpegthumbnailer. Check ffmpegthumbnailer install and verify video is not corrupt. Original error: No such file or directory - ffmpegthumbnailer
It seems the ffmpeg work well but the ffmpegthumbnailer have some problem because I got exactly the same error when I installed ffmpeg and forgot to install ffmpegthumbnailer on local. This problem on local was solved when I finished installed ffmpegthumbnailer.
I also ran command heroku run "ffmpegthumbnailer -version" to verify and I got bash: ffmpegthumbnailer: command not found
I have tried the solution shown in this link: akomic/heroku-buildpack-ffmpegthumbnailer but it doesn't work.
Is there any solution I can try? Thanks for your help in advance!
Have you tried this one https://gist.github.com/ttseng/7682321? It's well documented and I believe it will help.
I used this Aptfile:
fonts-liberation
libreoffice-base-core
libreoffice-calc
libreoffice-writer
libreoffice
libpython2.7
pdf2htmlex
poppler-utils
And installation completed successfully. I even checked version of pdf2htmlEX in heroku bash.
pdf2htmlEX --version
pdf2htmlEX version 0.14.6
Copyright 2012-2015 Lu Wang <coolwanglu#gmail.com> and other contributors
Libraries:
poppler 0.41.0
libfontforge 20120731
Default data-dir: /usr/share/pdf2htmlEX
Supported image format: png jpg
But when I try to convert real PDF documents I'm getting this error:
Error: Cannot open the manifest file
I found on other sites that I need to run "make install" to fix this issue but not sure if it's possible with heroku.
Any help will be appreciated. Thanks
Similar answer on pdf2htmlEX
On heroki-18 I faced similar issue and resolved it by passing data-dir while converting.
If you are ruby you can use Kristin gem with master branch
look at this:
https://github.com/coolwanglu/pdf2htmlEX/issues/749
you just need to add the optional parameter --data-dir C:\<pdf2htmlex-folder>\data
to the command
I've upgraded to rails 5.2 and am implementing ActiveStorage. ActiveStorage uses mutool for PDF processing. I have successfully installed mutool locally using homebrew.
mutool is a bit confusing.
rails docs claim to require "mutool",
homebrew installs "mupdf-tools",
and heroku wants "mupdf".
I have successfully installed apt and mupdf on heroku following these steps:
- add a new Aptfile to the root of my application with only "mupdf" listed
- commit and push the Aptfile
- THEN run heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
- push again so heroku will finish installing apt and mupdf
mupdf builds successful during the push
heroku buildpacks now returns
1. https://github.com/heroku/heroku-buildpack-apt
2. heroku/ruby
If I refresh a page calling for a variant on a PDF, the image fails to process and the job kicks back the following error:
Errno::ENOENT: No such file or directory - mutool
It seems mutool and mupdf are synonomous...so, I tried swapping out mutool for mupdf in my Aptfile...that failed to build from "...not found'.
Anyone know what action I need to take?
PS: This is part of implementing rails 5.2 using ActiveStorage.
UPDATE
I added mupdf-tools to Aptfile and that seems to fix the "no such file or directory" error. I don't know for sure because a new errors surfaces
MiniMagick::Invalid: `identify /tmp/mini_magick20180105-4-pvub9r` failed with error: identify.im6: no decode delegate for this image format `/tmp/mini_magick20180105-4-pvub9r' # error/constitute.c/ReadImage/544.
MiniMagick::Error: `identify -format %m %w %h %b /tmp/ActiveStorage20180105-4-1f46tem[0]` failed with error: identify.im6: no decode delegate for this image format `/tmp/ActiveStorage20180105-4-1f46tem' # error/constitute.c/ReadImage/544.
Heroku recommends Poppler as an alternative to MuPDF for licensing reasons (MuPDF has a commercial license).
They created a buildpack for Active Storage Previews that covers PDFs as well as Video files.
I know this is a bit old, but if you're still having this issue I was able to resolve this by updating the version of mupdf-tools to at least 1.8.
To do this with Heroku, you'll want to link directly to the latest release.
Add heroku-buildpack-apt, and then add a custom Aptfile. Note that you'll need to add the Aptfile first in order for the buildpack to work.
Here is what my Aptfile looks like:
:repo:deb http://archive.ubuntu.com/ubuntu artful main universe
imagemagick
ffmpeg
mupdf-tools
To test that you have the right version, you can use heroku ps:exec to test. Run mutool -v and you should be on version 1.11.
I'm trying to setup ImageMagick so I can use the Paperclip gem for Ruby on Rails. I've looked at pretty much every question on StackOverflow about the issue, but they all just skip over my issue, that none of the ImageMagick commands are recognized on the CommandPrompt.
I downloaded and then installed ImageMagick-7.0.1-1-Q16-x64-dll.exe on this page
I installed the program to my C: directory, so that there wouldn't be an issue with spaces in the Path, and I used all default installation selections and even selected "Install development headers" which some answers said to do. My issue is that when ImageMagick finishes installing, and it says to test some commands (like "convert -version) on Command Prompt, they all result in
"'convert' is not recognized as an internal or external command ...."
On the command prompt. What could be an issue? Every step-by-step tutorial automatically assumes that these commands are recognized. Most troubleshooting involves steps afterwards.
Here's the documentation for paperclip. All I have to do is make sure the gem has access to ImageMagick, by putting in the development.rb file:
Paperclip.options[:command_path] = "/usr/local/bin/"
In order to find that path above, however, the documentation says to type "which convert". I've researched this and apparently that's a Unix command, and not something for Windows.
So basically, what steps do I need to take so that paperclip has access to ImageMagick? Why aren't basic ImageMagick commands recognized, even after a completed installation?
When you install ImageMagick under Windows, they is a button you need to check that tells the script to install "legacy" utilities such as convert. Reinstall, click on this button, and convert is ready to use. Alternatively, install ImageMagick 6.X which deploys convert automatically.
Windows users, I've answered most of this here.
The windows command line won't run which convert. You'll need to use something like git bash.
Reinstalling image magick won't hurt. You could try another file. I know the dll one (you mentioned) is top of the list, the next one is 64bit as well. You must check every option at install as paperclip will use lots of image magick functionality behind the scenes so check all options. Then restart the system.
in command before typing convert you have to type in magick then convert
keep in mind you are using a newer version of IM hence you have to start by typing 'magick' and then follow other command
imagemagic and wkhtml are available in users/mithin
I have tried setting the path in profile file.
This is the content of .profile :
export PATH="/usr/bin:/usr/local/bin:$PATH"
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/Users/mithin/:$PATH"
export PATH="/Users/mithin/ImageMagick-6.6.7/bin:$PATH"
When I try to run "identify" in terminal it runs properly
And when I try to run my Ruby on rails project it gives error.
Similar things happen with "wkhtmltopdf"
in terminal it runs properly
but in ror output it gives :
sh: wkhtmltopdf: command not found
Can anyone please point my mistake ?
For Paperclip to find the commands outside of the default install location, add the following to the appropriate file within /config/environments/
Paperclip.options[:command_path] = "/Users/mithin/ImageMagick-6.6.7/bin"