- The module here I used is PDF::FromHTML.
- It is used for converting HTML file into PDF file.
- Refer "http://search.cpan.org/~audreyt/PDF-FromHTML-0.31/" for more information about the Module.
#Add Module..
use PDF::FromHTML;
#Create object for that Module..
my $pdf = new PDF::FromHTML( encoding => 'utf-8' );
# Loading from a file..
$pdf->load_file('source.htm');
my $pdf = new PDF::FromHTML( encoding => 'utf-8' );
# Loading from a file..
$pdf->load_file('source.htm');
# Or from a scalar reference:
#$input = "<html><body>sample test<br><b>deiveegan</b></body></html>";
# $pdf->load_file(\$input);
# Perform the actual conversion..
$pdf->convert(# $pdf->load_file(\$input);
# Perform the actual conversion..
Font => 'arial.ttf',
LineHeight => 18,
Landscape => 2,
);
# Write to a file:.
$pdf->write_file('Target.pdf');
# Or to a scalar reference:
# $pdf->write_file(\$output);
Some other convert parameters..
PageWidth 640
PageResolution 540
FontBold 'HelveticaBold'
FontOblique 'HelveticaOblique'
FontBoldOblique 'HelveticaBoldOblique'
LineHeight 12
FontUnicode 'Helvetica'
Font (same as FontUnicode)
PageSize 'A4'
Landscape 0
No comments:
Post a Comment