The properties x, start_y, next_y, start_h, next_h define the coordinates and size of the table. The start_y and start_h set the table position and height on the first page of the pdf. If there is more data than can be displayed on the first page it will continue on further pages with the y coordinates and height defined by next_y and next_h.
Here is an example that I extracted from one of my working programs, I have trimmed it down to remove irrelevant code so it is not a complete working example but should give you an idea.
use PDF::API2;
use PDF::Table;
my $pdftable = new PDF::Table;
my $pdf = new PDF::API2(-file => 'reports/report.pdf');
$pdf->mediabox('A4');
my $page = $pdf->page;
# define header properties
my $hdr_props =
{
# This param could be a pdf core font or user specified TTF.
# See PDF::API2 FONT METHODS for more information
font => $pdf->corefont("Times", -encoding => "utf8"),
font_size => 10,
font_color => '#555555',
bg_color => 'grey',
repeat => 1, # 1/0 eq On/Off if the header row should be repea
+ted to every new page
};
# build the table layout
$pdftable->table(
# required params
$pdf,
$page,
\@pdf_report_data, # report data in an array of hashes
x => 50,
w => 495,
start_y => 755, # sets the y position of the table on the firs
+t page
next_y => 775, # sets the y position of tables on subsequent
+pages
start_h => 730, # sets the height of the table on the first pa
+ge
next_h => 750, # sets the height of the table on subsequent p
+ages
# some optional params
padding => 5,
padding_right => 10,
background_color_odd => "white", # cell background colour f
+or odd rows
background_color_even => "lightgrey", # cell background colour f
+or even rows
header_props => $hdr_props, # loads the header properties as d
+efined above
);
# do other stuff with $pdf
# save pdf
$pdf->saveas();