-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column spanning multiple (as in many) rows breaks the table layout #403
Comments
This appears to be caused by issue prawnpdf/prawn-table#70 in prawn-table. For tables, all Asciidoctor PDF does is construct an array of table data and settings and pass those to prawn-table to handle the drawing. If prawn-table gets it wrong, then Asciidoctor PDF gets it wrong. I'm going to mark this as upstream. I encourage you to try to duplicate your use case using the prawn-table API to help the developers understand, solve, and test the problem. |
Any time the cell height exceeds the page height this happens.
|
That's a different issue. When using this converter (due to a limitation in prawn-table), a cell cannot exceed the height of the page. This is mentioned in the list of limitations. See https://docs.asciidoctor.org/pdf-converter/latest/features/#limitations |
I've assessed the problem reported by this issue and I'm afraid there's nothing we can do. It's a hard limitation of prawn-table that a rowspan cell cannot exceed the height of a page. You can reproduce the problem without Asciidoctor PDF by running this script: require 'prawn'
require 'prawn/table'
Prawn::Document.generate 'out.pdf' do
table_data = [[{ colspan: 1, rowspan: 35, content: 'Group' }, { colspan: 1, rowspan: 1, content: 'Member 1' }]]
34.times do |idx|
table_data << [{ colspan: 1, rowspan: 1, content: %(Member #{idx + 2}) }]
end
table table_data, width: bounds.width
end This is similar to prawnpdf/prawn-table#133, though the problem has been reported many other times. I just don't have time right now to dry to dissect the code in prawn-table to figure out how we could lift this limitation. The best advice I can offer is to split up the cells so that they don't exceed this limit. I suppose prawn-table would need to detect the situation where a rowspan is forcing a cell to become taller than the height of the page and automatically split that rowspan so that part can go on one page and part goes on the next. If someone knows how to fix it, please chime in and we can revisit. See https://github.com/prawnpdf/prawn-table/blob/master/lib/prawn/table.rb#L265 As a stop-gap, I'm willing to apply the fix proposed in prawnpdf/prawn-table#106. That seems reasonable to me as at least it would allow rowspans that do fit on a page to work. I think that's a reasonable compromise to start with. |
…st row does not fit in space remaining on current page
…st row does not fit in space remaining on current page
…st row does not fit in space remaining on current page
…st row does not fit in space remaining on current page
Note: I really appreciate asciidoctor-pdf, since it does exactly what I need (in most cases) and allows to keep docs for html and pdf aligned easily. So thanks for all the good work!
However, for some documents I work with, the adoc is generated from xml sources, where there tend to be some border cases with excessively long lists of elements and such.
In this specific case I tried to work around the asciidoctor-pdf limitation #6 for putting lists into table cells, by putting the name of a group into a cell that spans multiple rows and add rows for each group member as follows
This produces very satisfying PDF output in general:
tableList10.pdf
However when the Group starts to exceed more than one page, the members colunm (incl. the border) is shown on the last page only.
Here is a cell spanning 100 rows to illustrate the general behavior:
tableList100.pdf
With the the customized theme I am using where
I assume might affect available lines per page, the border line is between 33 and 34 rows:
tableList34.pdf
tableList33.pdf
Page breaks seem to be problematic in general for this, since also a 10 row table spanning a page break causes this behavior:
tableList10time4.pdf
You can use the following code (as I did) to generate your own test files (number of rows is first parameter ...)
Let me know, if you need anything else. I'd be happy to help by analyzing this further ... just point me in the right direction ...
The text was updated successfully, but these errors were encountered: