Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Creating a PDF with multiple tables and where data items can spread multipage

by roboticus (Chancellor)
on Sep 12, 2017 at 17:15 UTC ( [id://1199221]=note: print w/replies, xml ) Need Help??


in reply to Creating a PDF with multiple tables and where data items can spread multipage

tweetiepooh:

It looks like PDF::Table should be able to do the job. It automatically adds pages to your PDF document as it needs to. When you generate the table, it returns the reference to the last page it created, the vertical position of the end of the table (y) on the last page, and the number of pages it added. So you should be able to continue generating your document, something like:

# all the setup stuff for PDF and PDF table for my $table (@tables) { # Implementation left as an exercise to the reader ;^) $data = make_table_data($table); # Generate the table my ($last_pg, $pg_cnt, $y) = $pdfTblGen->table($PDF, $cur_pg, $data +, %settings); if ($y < FOO) { # Not enough space on the page for the next thing, so create a n +ew page . . . } else { # Still plenty of space ... add stuff to page at $y + some whitespace ... } }

The documentation is a bit skimpy, but there are a couple examples in the distribution you can play with. I installed it a few minutes ago, looks legit.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Creating a PDF with multiple tables and where data items can spread multipage
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1199221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found