有谁知道如何上传多页PDF文件使用回形针和每个页面转换成JPEG?
到目前为止,我每次上传PDF时,它只是让我看到了PDF的第一页为JPEG。 不过,我想能够上传和每一页从PDF转换为JPEG。
是否有任何宝石或插件,可以帮我上载有10微克PDF和数据库10个JPEG文件转换/店铺?
我已经看过docsplit图像宝石,但我不知道这是解决方案最好的解决方案或它是如何工作。
Post.rb
class Post < ActiveRecord::Base
belongs_to :Blogs
attr_accessible :content, :title, :pdf
has_attached_file :pdf,
:url => "/assets/products/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/products/:id/:style/:basename.:extension"
validates_attachment_content_type :pdf,
:content_type => [ 'application/pdf' ],
:message => "only pdf files are allowed"
end
_form.html.erb
<%= form_for ([@post]), :html => { :multipart => true } do |f| %>
<%= f.file_field :pdf %>
<% end %>
show.html.erb
<%= image_tag @post.pdf.url(:original) %>