首页 文章

如何在heroku上安装mupdf?

提问于
浏览
2

我已升级到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在推动期间 Build 成功

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中替换mupdf的mutool ...无法从“...未找到”构建 .

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

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

更新

我将mupdf-tools添加到Aptfile,这似乎修复了“没有这样的文件或目录”错误 . 我不确定,因为一个新的错误浮出水面

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.

2 回答

  • 1

    Heroku recommends Poppler as an alternative to MuPDF出于许可原因(MuPDF拥有商业许可证) .

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

  • 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 .

相关问题