• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

inc/Module/H23-Oct-2019-3,1592,369

lib/PDF/H23-Oct-2019-5,5952,759

script/H23-Oct-2019-9829

t/H23-Oct-2019-117

ChangesH A D23-Oct-20193.7 KiB12974

MANIFESTH A D23-Oct-20191.7 KiB5352

META.ymlH A D23-Oct-20193.6 KiB9998

Makefile.PLH A D23-Oct-20191.2 KiB4941

READMEH A D23-Oct-20192.6 KiB8864

SIGNATUREH A D23-Oct-20196.5 KiB8275

README

1NAME
2    PDF::FromHTML - Convert HTML documents to PDF
3
4SYNOPSIS
5        my $pdf = PDF::FromHTML->new( encoding => 'utf-8' );
6
7        # Loading from a file:
8        $pdf->load_file('source.html');
9
10        # Or from a scalar reference:
11        # $pdf->load_file(\$input);
12
13        # Perform the actual conversion:
14        $pdf->convert(
15            # With PDF::API2, font names such as 'traditional' also works
16            Font        => 'font.ttf',
17            LineHeight  => 10,
18            Landscape   => 1,
19        );
20
21        # Write to a file:
22        $pdf->write_file('target.pdf');
23
24        # Or to a scalar reference:
25        # $pdf->write_file(\$output);
26
27DESCRIPTION
28    This module transforms HTML into PDF, using an assortment of XML
29    transformations implemented in PDF::FromHTML::Twig.
30
31    There is also a command-line utility, html2pdf.pl, that comes with this
32    distribution.
33
34PUBLIC METHODS
35  convert(%params)
36    Convert the loaded file to PDF. Valid parameters are:
37
38        PageWidth         640
39        PageResolution    540
40        FontBold          'HelveticaBold'
41        FontOblique       'HelveticaOblique'
42        FontBoldOblique   'HelveticaBoldOblique'
43        LineHeight        12
44        FontUnicode       'Helvetica'
45        Font              (same as FontUnicode)
46        PageSize          'A4'
47        Landscape         0
48
49HINTS & TIPS
50  <img> tags
51    Add the height and width attributes if you are creating the source HTML,
52    it keeps PDF::FromHTML from having to open and read the source image
53    file to get the real size. Less file I/O means faster processing.
54
55CAVEATS
56    Although PDF::FromHTML will work with both HTML and XHTML formats, it is
57    not designed to utilise CSS.
58
59    This means any HTML using external or inline CSS for design and layout,
60    including but not limited to: images, backgrounds, colours, fonts etc...
61    will not be converted into the PDF.
62
63    To get an idea of the likely resulting PDF, you may wish to use an
64    non-CSS capable browser for testing first.
65
66    There is currently no plan to adapt this module to utilise CSS. (Patches
67    welcome, though!)
68
69SEE ALSO
70    html2pdf.pl is a simple command-line interface to this module.
71
72    PDF::FromHTML::Twig, PDF::Template, XML::Twig.
73
74CONTRIBUTORS
75    Charleston Software Associates <info@charletonsw.com>
76
77AUTHORS
78    Audrey Tang <cpan@audreyt.org>
79
80CC0 1.0 Universal
81    To the extent possible under law, 唐鳳 has waived all copyright and
82    related or neighboring rights to PDF-FromHTML.
83
84    This work is published from Taiwan.
85
86    <http://creativecommons.org/publicdomain/zero/1.0>
87
88