### CODE
#!/usr/local/bin/perl
use PDF::API2;
use PDF::Table;
my $pdftable = new PDF::Table;
my $pdf = PDF::API2->new(-file => "forwardever.pdf");
$pdf->mediabox(595,842);
my $page = $pdf->page;
#############################################
my $col_props = [
{
min_w => 40, # Minimum column width.
justify => 'left', # One of left|right ,
font => $pdf->corefont("Courier", -encoding => "latin1"),
font_size => 10,
font_color=> 'black',
background_color => '#FFFFFF',
},
{
min_w => 70,
justify => 'left',
font => $pdf->corefont("Courier", -encoding => "latin1"),
font_size => 10,
font_color=> 'black',
background_color => '#FFFFFF',
},
{
min_w => 300,
justify => 'left',
font => $pdf->corefont("Courier", -encoding => "latin1"),
font_size => 10,
font_color=> 'black',
background_color => '#FFFFFF',
},
{
min_w => 120,
justify => 'left',
font => $pdf->corefont("Courier", -encoding => "latin1"),
font_size => 10,
font_color=> 'black',
background_color => '#FFFFFF',
},
];
#############################################
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("Courier", -encoding => "utf8"),
font_size => 10,
font_color => '#000000',
bg_color => '#DDDDDD',
repeat => 1, # 1/0 eq On/Off if the header row should
be repeated to every new page
};
#############################################
my @some_data = ();
my $testaaa = [
"1.",
"2.",
"3.",
"4."
];
push (@some_data,$testaaa);
#############################################
my $testaaa = [
"",
"",
"",
""
];
push (@some_data,$testaaa);
my $testaaa = [
"",
"",
"3:",
$test.' 4'
];
push (@some_data,$testaaa);
#############################################
my $some_data =\@some_data;
#############################################
$left_edge_of_table = 50;
#############################################
my ($end_page, $pages_spanned, $table_bot_y) = $pdftable->table(
# required params
$pdf,
$page,
$some_data,
x => $left_edge_of_table,
w => 530,
start_y => 800,
next_y => 750,
start_h => 800,
next_h => 700,
# some optional params
border_color => '#FFFFFF',
padding => 3,
padding_right => 3,
column_props => $col_props, # see section COLUMN PROPERTIES
header_props => $hdr_props, # see section HEADER ROW PROPERTIES
max_word_length=> 40,
);
#############################################
my $fnt1 = $pdf->corefont('Courier',-encoding => 'latin1');
my $txt = $page->text;
$txt->font($fnt1, 10);
### $txt->fillcolor('#000000'); ### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$txt->translate(575,30);
$txt->text_right('TEST');
$pdf->save;
$pdf->end();
1;