Ruby 对虾pdf和分页符

Ruby 对虾pdf和分页符,ruby,pdf-generation,prawn,Ruby,Pdf Generation,Prawn,我正在尝试使用Prawn 0.12.0生成pdf 我呈现的内容非常动态,通常跨越多个页面 我遇到的问题是,当它自动开始一个新页面时,当前的边界框“断开”。 在新页面上呈现的文本没有正确的边界框。 如果我使用stroke\u bounds我可以在页面的最底部看到底部的笔划。 我在各种论坛上都读到过关于这个问题的文章,但似乎不知道到底发生了什么 以下是循环内容的特定代码: items.each do |item| group do title_text = [{ text: item.t

我正在尝试使用Prawn 0.12.0生成pdf

我呈现的内容非常动态,通常跨越多个页面

我遇到的问题是,当它自动开始一个新页面时,当前的边界框“断开”。 在新页面上呈现的文本没有正确的边界框。 如果我使用
stroke\u bounds
我可以在页面的最底部看到底部的笔划。 我在各种论坛上都读到过关于这个问题的文章,但似乎不知道到底发生了什么

以下是循环内容的特定代码:

items.each do |item|
  group do
    title_text = [{ text: item.title, styles: [@heading_style], size: 11}]
    formatted_text title_text
    text(item.description, size: 9)
    stroke { line(bounds.bottom_left, bounds.bottom_right); }
  end
end

正如您所知,我想在每个项目的正下方画一条线,这就是为什么我需要当前边界框是正确的。

根据对虾文档,位于:

将边界框绑定到页边距:

A bounding box is a structure which provides boundaries for inserting content. A bounding box
also has the property of relocating the origin to its relative bottom-left corner. However, be aware
that the location specified when creating a bounding box is its top-left corner, not bottom-left
(hence the [100, 300] coordinates below).
对于将在页面间优雅流动的边界类型,跨距是更好的选择:

Span is a different kind of bounding box as it lets the text flow
gracefully onto the next page. It doesn't matter if the text started
on the middle of the previous page, when it flows to the next page
it will start at the beginning. 
跨距应能够包含所需的线条笔划。
希望这有帮助

遇到同样的问题。您能找到什么吗?对于发现此问题并注意到代码中的
group
方法的任何人:
NotImplementedError:Document\group已被禁用,因为每当跨过页面边界时,其实现会导致文档损坏。我们将在未来的版本中尝试重新实现它