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 repeated 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 first 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 page next_h => 750, # sets the height of the table on subsequent pages # some optional params padding => 5, padding_right => 10, background_color_odd => "white", # cell background colour for odd rows background_color_even => "lightgrey", # cell background colour for even rows header_props => $hdr_props, # loads the header properties as defined above ); # do other stuff with $pdf # save pdf $pdf->saveas();