Closed davewood closed 1 year ago
In #52, I propose to add a flag to return the height of each row and the overall height, to allow you to decide the height parameter desired (controlling where to split the table on each page, via an array of heights and y positions). There's no reason you couldn't use this information to decide whether to start a table on this page or the next, and whether you could fit two tables on one page. Does that sound like something that would satisfy your request?
this one? -> https://github.com/PhilterPaper/PDF-Table/issues/52#issuecomment-733377695
I guess that would work. the array returned contains the height of the table to be inserted but doesnt add anything to the pdf file, right? why is it an array though, what else is returned?
Its primary purpose is to try to fit a table across multiple pages without splitting within any row, by knowing the height of each row (and the header and [future] footer). The first element (total height) is all you're interested in.
sounds great, any idea when this enhancement canbe expected?
as usual, thank you for the swift and productive feedback.
What's currently on my plate for PDF::Table:
I would guess at this point to see the row heights by late summer, unless some higher priority problem (bug) shows up, in PDF::Table or PDF::Builder. Or, revenue-generating work ramps up. All I can say at this point is that it's on the list, and I will get to it as soon as I can.
A related item could be using something like Text::Layout formatting to determine the height of a cell, and feeding that in to PDF::Table to specify the row(s) height. That is, externally specify the height of row(s) via min_rh
but using that as an absolute height and not a minimum (i.e., don't recalculate the actual vertical space needed; possibly just cut off the cell content if it overflows). In general, a max_rh
might be useful to add (min = max = externally calculated height). The same might be done for cell width, too. Consideration should be given to integrating Text::Layout (or similar) into PDF::Builder to hide this extra step from the user.
Update: per #74, it looks like Text::Layout isn't quite there yet (no word wrap).
Dave, I have implemented this and put it in the library (GitHub). The files of interest are lib/PDF/Table.pm, INFO/Table.html, and examples/vsizes.pl. The new option is ink => 0. Please give it a try and let me know if it meets your needs.
Sorry to take so long, but it's been a tough last year and there was also a bunch of stuff queued up in front of it. Maybe I can get a new PDF::Table release out within the next few months?
This is in the 1.004 release just sent to CPAN. See examples/vsizes.pl for an example of using.
thank you so much!
I will test it and tell you about my experience!
is it possible to calculate the height of the table BEFORE adding it to the pdf by executing
$pdftable->table(...)
?example: I have 2 tables. if both of them do not fit on the current page i want to create a new page and add the two tables there.