根据 pdf 页面将 Pdf 转换为图像 [英] Convert Pdf to Image as per the pdf page
本文介绍了根据 pdf 页面将 Pdf 转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想上传一个 pdf 然后我想按照 pdf 页面转换为图像意味着如果 pdf 有 2 个页面,那么将生成 2 个图像.
I want to upload a pdf then after I want to convert to image as per the pdf page means that If pdf have 2 pages then 2 images will generate.
生成此图像后,我想将其存储到表中.
After generate this image I want to store into table.
例如
我有一个 pdf 表格,我上传了一个 PDF,另一个表格是我想存储新生成的 pdf 图像的图像.
I have a pdf table in that I upload a PDF and another table is image that I want to store pdf's images that newly generated.
我只需要关于如何根据页面从 pdf 生成图像的帮助
那我该怎么做?
请帮帮我?
谢谢
推荐答案
您可以使用 RMagick 来完成ruby 的库.
You can accomplish it using RMagick lib for ruby.
例如:
require 'RMagick'
pdf = Magick::ImageList.new("file.pdf")
pdf.each_with_index do |page_img, i|
page_img.write "#{i}_pdf_page.jpg"
end
这篇关于根据 pdf 页面将 Pdf 转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文