下面的代码能够组合图像,但它们并不完全适合PDF页面。在Prawn中有一个设置,允许组合适合页面大小的图像并导出为PDF吗?
require 'prawn'
require 'fastimage'
Prawn::Document.generate("hello.pdf", :page_layout => :landscape) do
(1..40).each do|i|
size = FastImage.size("./java/sl#{i}.jpg")
start_new_page(:size => size,:layout => :landscape)
image "./java/sl#{i}.jpg"
end
end发布于 2014-06-06 18:03:53
尝试使用at属性为图像添加一些位置
例如:
image "./java/sl#{i}.jpg", :at => [x,y]根据需要指定x,y的值。
https://stackoverflow.com/questions/24079094
复制相似问题