【问题标题】:How to install mupdf on heroku?如何在heroku上安装mupdf?
【发布时间】:2018-06-14 18:43:05
【问题描述】:

我已升级到 rails 5.2 并正在实施 ActiveStorage。 ActiveStorage 使用 mutool 进行 PDF 处理。我已经使用自制软件在本地成功安装了 mutool。

mutool is a bit confusing.  

rails docs claim to require "mutool", 
homebrew installs "mupdf-tools", 
and heroku wants "mupdf".

我已经按照以下步骤在heroku上成功安装了apt和mupdf:

- 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 在推送期间构建成功

heroku buildpacks now returns    
1. https://github.com/heroku/heroku-buildpack-apt
2. heroku/ruby

如果我刷新页面以调用 PDF 上的变体,则图像无法处理并且作业会返回以下错误:

  Errno::ENOENT: No such file or directory - mutool

看来 mutool 和 mupdf 是同义词...所以,我尝试在我的 Aptfile 中将 mutool 换成 mupdf...未能从“...未找到”构建。

有人知道我需要采取什么行动吗?

PS:这是使用 ActiveStorage 实现 rails 5.2 的一部分。

更新

我在 Aptfile 中添加了 mupdf-tools,这似乎修复了“没有这样的文件或目录”错误。我不确定,因为出现了新的错误

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.

【问题讨论】:

  • 您能否同时包含指向存储库和构建包的链接?谢谢
  • 感谢@FabrizioBertoglio,我更新了我的问题以包括我使用的步骤和构建包

标签: ruby-on-rails heroku mupdf rails-activestorage


【解决方案1】:

Heroku recommends Poppler as an alternative to MuPDF 出于许可原因(MuPDF 具有商业许可)。

他们创建了一个buildpack for Active Storage Previews,涵盖 PDF 和视频文件。

【讨论】:

    【解决方案2】:

    我知道这有点老了,但如果你仍然遇到这个问题,我可以通过将 mupdf-tools 的版本更新到至少 1.8 来解决这个问题。

    要使用 Heroku 执行此操作,您需要直接链接到最新版本。

    添加heroku-buildpack-apt,然后添加自定义Aptfile。请注意,您需要先添加 Aptfile 才能使 buildpack 工作。

    这是我的 Aptfile 的样子:

    :repo:deb http://archive.ubuntu.com/ubuntu artful main universe
    imagemagick
    ffmpeg
    mupdf-tools
    

    要测试您是否拥有正确的版本,您可以使用heroku ps:exec 进行测试。运行mutool -v,你应该是1.11版本。

    【讨论】:

    • 谢谢@mike-wilson。重要的是要注意 mutool 没有公共许可证。最初添加到 Rails 时,这似乎是一个疏忽。 Rails 5.2 不会附带 mutool,而是将其替换为 popper....这是 GNU。我正在运行 5.2.0.rc1 的最新提交,popper 可以很好地处理 PDF 预览。
    猜你喜欢
    • 2019-06-09
    • 2015-06-12
    • 2017-01-04
    • 2020-11-01
    • 2017-09-21
    • 2019-01-31
    • 2013-05-31
    • 2012-07-27
    • 1970-01-01
    相关资源
    最近更新 更多