使用pdf文件的整个空间

时间:2010-12-01 11:40:56

标签: pdf ruby-on-rails-3 pdf-generation prawn prawnto

我正在使用prawn来创建pdf文件,但它总是在页面周围留下一些空格/边距。我们不能使用pdf文件的整个空间而不留下任何边距吗?

谢谢!!!

1 个答案:

答案 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

这将绘制显示边距的页面边界。存在间隙,即通常为打印区域定义的边距