NAME
PDF::FromHTML - Convert HTML documents to PDF
SYNOPSIS
my $pdf = PDF::FromHTML->new( encoding => 'utf-8' );
$pdf->load_file('source.html');
$pdf->convert(
# With PDF::API2, font names such as 'traditional' also works
Font => 'font.ttf',
LineHeight => 10,
Landscape => 1,
);
$pdf->write_file('target.pdf');
DESCRIPTION
This module transforms HTML into PDF, using an assortment of XML transformations implemented in PDF::FromHTML::Twig.
There is also a command-line utility, html2pdf.pl, that comes with this distribution.
PUBLIC METHODS
convert(%params)
Convert the loaded file to PDF. Valid parameters are:
PageWidth 640
PageResolution 540
FontBold 'HelveticaBold'
FontOblique 'HelveticaOblique'
FontBoldOblique 'HelveticaBoldOblique'
LineHeight 12
FontUnicode 'Helvetica'
Font (same as FontUnicode)
PageSize 'A4'
Landscape 0
HINTS & TIPS
<img> tags
Add the height and width attributes if you are creating the source HTML, it keeps PDF::FromHTML from having to open and read the source image file to get the real size. Less file I/O means faster processing.
SEE ALSO
PDF::FromHTML::Twig, PDF::Template, XML::Twig.
AUTHORS
Audrey Tang <cpan@audreyt.org>
CONTRIBUTORS
Charleston Software Associates <info@charletonsw.com>
COPYRIGHT
Copyright 2004, 2005, 2006, 2007 by Audrey Tang <cpan@audreyt.org>.
This software is released under the MIT license cited below. Additionally, when this software is distributed with Perl Kit, Version 5, you may also redistribute it and/or modify it under the same terms as Perl itself.
The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.