jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.34k stars 787 forks source link

How to handle a Cell that have a height superior to the page height #189

Open TeaBough opened 6 years ago

TeaBough commented 6 years ago

If you the take the Fpdf_WrappedTableCells example and instead of having : word := fmt.Sprintf("%d:%s", i, strings.Repeat("A", i%100)) you have : word := fmt.Sprintf("%d:%s", i, strings.Repeat("A", 400))

This means that one cell is bigger than a whole page and thus must be split into 2 pages. If you run the example with 400 A's you get an odd result. Does anyone have an idea of to handle proprely this case ?

jung-kurt commented 6 years ago

I haven't delved too deeply into this, but it seems like the AddPage() method in the example code may be called too soon.

Any insights, @flibustenet?

flibustenet commented 6 years ago

Never seen situation like that... But it's an interesting exercise !

TeaBough commented 6 years ago

I'm actually experiencing this problem with a project of mine, where the user has a textarea that gets transformed into a cell in a pdf. Sometimes users type a lot of text resulting in a cell bigger than a single page ...

TeaBough commented 6 years ago

There is the same problem with the Fpdf_SplitLines_tables example. If you fill a cell with a text that makes the table fit on 2 pages, it creates more than 10 pages.