You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error details
In the below example, a series of 10 tables of two rows each is created using the unbreakable context manager based on the logic described here.
Instead of the page break triggering before the unbreakable context manager as described, the table that triggers the page break (which should have cells labelled Test 31 to Test 37) does not get displayed.
This is perhaps down to me not fully understanding the syntax around using unbreakable, but I don't think so! I'm open to correction, of course!
Minimal code
fromitertoolsimportbatchedimportfpdfPDF=fpdf.FPDF()
PDF.set_font("Helvetica", size=10)
PDF.add_page()
# create some test dataCELL_COUNT=50labels= [f"Test {i+1}"foriinrange(CELL_COUNT)]
# group the data in batchescol_count=5label_groups=list(batched(labels, col_count))
# generate a separate table for each group with the labels as table headersforgroupinlabel_groups:
withPDF.unbreakable() asdoc:
doc.ln()
withdoc.table(
text_align="CENTER",
gutter_width=10,
) astable:
table.row(group)
row=table.row()
foritemingroup:
row.cell("DON'T PANIC - CELL LEFT INTENTIONALLY BLANK")
PDF.output("unbreakable_bug_test.pdf")
Environment
Please provide the following information:
Operating System: Windows 11
Python version: 3.12.1
fpdf2 version used: 2.7.9
The text was updated successfully, but these errors were encountered:
nocalla
changed the title
FPDF.unbreakable() doesn't work well with table()
FPDF.unbreakable() drops table instead of adding page break beforehand
Jul 20, 2024
As you can see in #1200, the table code is currently under a fundamental overhaul. I don't know if there is a quick fix possible for the current code, but otherwise you'll have to be patient until that PR lands. It will be more flexible about page breaks in general, and hopefully solve your problem as well.
Error details
In the below example, a series of 10 tables of two rows each is created using the
unbreakable
context manager based on the logic described here.Instead of the page break triggering before the
unbreakable
context manager as described, the table that triggers the page break (which should have cells labelled Test 31 to Test 37) does not get displayed.This is perhaps down to me not fully understanding the syntax around using
unbreakable
, but I don't think so! I'm open to correction, of course!Minimal code
Environment
Please provide the following information:
fpdf2
version used: 2.7.9The text was updated successfully, but these errors were encountered: