|
my $pdf = CtrlO::PDF->new(
logo => "sample/logo.png" ,
orientation => "portrait" ,
footer => "My PDF document footer" ,
header => "My PDF document header" ,
margin => 50,
logo_padding => 50,
top_padding => 60,
PDFlib => 'builder' ,
);
$pdf ->add_page;
$pdf ->heading( 'This is the main heading' );
$pdf ->heading( 'This is a sub-heading' , size => 12);
my $lorem = Text::Lorem->new();
my $paras = $lorem ->paragraphs(30);
$pdf ->text( $paras );
my $data =[
[ 'Fruit' , 'Quantity' ],
[ 'Apples' , 120],
[ 'Pears' , 90],
[ 'Oranges' , 30],
];
my $hdr_props = {
repeat => 1,
justify => 'center' ,
font_size => 8,
};
$pdf ->table(
data => $data ,
header_props => $hdr_props ,
);
my $file = $pdf ->content;
open my $pdf_out , '>' , 'out.pdf' ;
binmode $pdf_out ;
print $pdf_out $file ;
close $pdf_out ;
|