gofpdf icon indicating copy to clipboard operation
gofpdf copied to clipboard

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

Open TeaBough opened this issue 6 years ago • 4 comments

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 ?

TeaBough avatar Aug 22 '18 12:08 TeaBough

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?

jung-kurt avatar Aug 26 '18 13:08 jung-kurt

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

flibustenet avatar Aug 28 '18 15:08 flibustenet

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 avatar Aug 29 '18 08:08 TeaBough

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.

TeaBough avatar Sep 05 '18 18:09 TeaBough