Skip to content

Instantly share code, notes, and snippets.

@songjiayang
Created May 13, 2013 14:33
Show Gist options
  • Save songjiayang/5568731 to your computer and use it in GitHub Desktop.
Save songjiayang/5568731 to your computer and use it in GitHub Desktop.
pdf to image..
#方法一: Pdf To Images
# 将pdf 转化为image,主要用的Magick,找到两个方法,基本都相同
#function1
pdf =Magick::ImageList.new("test.pdf")
pdf.write("demo.jpg")
#function2
pdf= Magick::Image.read("test.pdf")
pdf.each_with_index do |image,index|
image.write("test-#{index.to_s}.jpg")
end
这个两个方法都是使用Magick来将pdf转化为images,基本相同,他们都存在一个问题就是转化出的image字体不是很清晰。。。待解决。。。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment