簡體   English   中英

PDF 文件的 image_tag 中的 ActionView::Template::Error (ActiveStorage::InvariableError)

[英]ActionView::Template::Error (ActiveStorage::InvariableError) in image_tag for PDF file

我正在嘗試按變體顯示應用程序/pdf 文件預覽。 我安裝了 mutool 1.17 並在config/environments/development.rb中指定了它的路徑。

config.active_storage.paths[:mutool] = '/usr/local/bin/mutool'

視圖是

<%= image_tag post.pdf.variant(resize_to_limit: [100, 100]) %>

我還應該怎么做才能顯示 PDF 文件預覽?

圖像文件(jpeg 和 png)顯示沒有任何問題。

我發現這是我的錯。 我監督了 Active Storage 文檔中的描述。 我應該使用 PDF 的預覽。 而已。

- <%= image_tag post.pdf.variant(resize_to_limit: [100, 100]) %>

+ <%= image_tag post.pdf.preview(resize_to_limit: [100, 100]) %>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM