我正在使用prawn来创建pdf文件,但它总是在页面周围留下一些空格/边距。我们不能使用pdf文件的整个空间而不留下任何边距吗?
谢谢!!!
答案 0 :(得分:1)
您指的是页面边界吗?
页面上使用的常规空间可以通过示例代码显示:
require 'prawn/core'
require 'prawn/layout'
Prawn::Document.generate('padded_box.pdf') do
stroke_bounds
text "Margin box"
padded_box(25) do
stroke_bounds
text "Bounding box padded by 25 on all sides from the margins"
padded_box(50) do
stroke_bounds
text "Bounding box padded by 50 on all sides from the parent bounds"
end
end
end
这将绘制显示边距的页面边界。存在间隙,即通常为打印区域定义的边距