# 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 new page . . . } else { # Still plenty of space ... add stuff to page at $y + some whitespace ... } }