#!/usr/bin/perl use strict; use warnings; use PDF::API2; use PDF::Table; my $pdf = new PDF::API2( -file => "table.pdf" ); my $pdftable1 = new PDF::Table; my $page = $pdf->page; my $col_props1 = [ { min_w => 36, justify => 'left', }, { min_w => 36, justify => 'left', background_color => '#FFFF00', }, { min_w => 36, justify => 'left', }, { min_w => 41, justify => 'left', }, ]; my $some_data = [ [ "test1", "3", "3", "3", "3", "3", "3" ], [ "test2", "3", "3", "3", "3", "3", "3" ], [ "test3", "3", "3", "3", "3", "3", "3" ], [ "test4", "3", "3", "3", "3", "3", "3" ], [ "test5", "3", "3", "3", "3", "3", "3" ], ]; $pdftable1->table( # required params $pdf, $page, $some_data, x => 50, start_y => 215, next_y => 0, start_h => 400, next_h => 0, # some optional params w => 85, padding => 5, padding_right => 1, padding_left => 5, font => $pdf->corefont("Helvetica Bold"), font_size => 4, column_props => $col_props1, #-cell_props => $row_props #cell background color for even rows ); $pdf->save();