Skip to content

Overflow in a table cell causes page break  #9

@clescuyer

Description

@clescuyer

I am struggling with an unwanted page break in a table. The contents of the cells varies in length. It seems some specific combinations of text length trigger the page break. Some much longer texts are displayed without a page break.

Here is the shortest snippet I found that has the page break. (I'm not using the font_size change in my app, it just happens to trigger the problem here.)

require 'rubygems'
require 'prawn/core'
require 'prawn/layout'
Prawn::Document.generate("problem.pdf") do
  @table = [[
    Prawn::Table::Cell.new(:text => "Some text with overflow.\nAnother line"),
    Prawn::Table::Cell.new(:text => 'foo'),
  ]]

  (8..9).each do |i|
    table @table, {:column_widths => { 0 => 100, 1 => 100}, :font_size => i}
  end
end

This happened in 0.5; I've built the gem from github and it's the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions