1HTML::FormatPS(3) User Contributed Perl Documentation HTML::FormatPS(3)
2
3
4
6 HTML::FormatPS - Format HTML as PostScript
7
9 version 2.10
10
12 use HTML::TreeBuilder;
13 $tree = HTML::TreeBuilder->new->parse_file("test.html");
14
15 use HTML::FormatPS;
16 $formatter = HTML::FormatPS->new(
17 FontFamily => 'Helvetica',
18 PaperSize => 'Letter',
19 );
20 print $formatter->format($tree);
21
22 Or, for short:
23
24 use HTML::FormatPS;
25 print HTML::FormatPS->format_file(
26 "test.html",
27 'FontFamily' => 'Helvetica',
28 'PaperSize' => 'Letter',
29 );
30
32 The HTML::FormatPS is a formatter that outputs PostScript code.
33 Formatting of HTML tables and forms is not implemented.
34
35 HTML::FormatPS is built on top of HTML::Formatter and so further detail
36 may be found in the documentation for HTML::Formatter.
37
38 You might specify the following parameters when constructing the
39 formatter object (or when calling format_file or format_string):
40
41 PaperSize
42 What kind of paper should we format for. The value can be one of
43 these: A3, A4, A5, B4, B5, Letter, Legal, Executive, Tabloid,
44 Statement, Folio, 10x14, Quarto.
45
46 The default is "A4".
47
48 PaperWidth
49 The width of the paper, in points. Setting PaperSize also defines
50 this value.
51
52 PaperHeight
53 The height of the paper, in points. Setting PaperSize also defines
54 this value.
55
56 LeftMargin
57 The left margin, in points.
58
59 RightMargin
60 The right margin, in points.
61
62 HorizontalMargin
63 Both left and right margin at the same time. The default value is
64 4 cm.
65
66 TopMargin
67 The top margin, in points.
68
69 BottomMargin
70 The bottom margin, in points.
71
72 VerticalMargin
73 Both top and bottom margin at the same time. The default value is
74 2 cm,
75
76 PageNo
77 This parameter determines if we should put page numbers on the
78 pages. The default value is true; so you have to set this value to
79 0 in order to suppress page numbers. (The "No" in "PageNo" means
80 number/numero!)
81
82 FontFamily
83 This parameter specifies which family of fonts to use for the
84 formatting. Legal values are "Courier", "Helvetica" and "Times".
85 The default is "Times".
86
87 FontScale
88 This is a scaling factor for all the font sizes. The default value
89 is 1.
90
91 For example, if you want everything to be almost three times as
92 large, you could set this to 2.7. If you wanted things just a bit
93 smaller than normal, you could set it to .92.
94
95 Leading
96 This option (pronounced "ledding", not "leeding") controls how much
97 is space between lines. This is a factor of the font size used for
98 that line. Default is 0.1 -- so between two 12-point lines, there
99 will be 1.2 points of space.
100
101 StartPage
102 Assuming you have PageNo on, StartPage controls what the page
103 number of the first page will be. By default, it is 1. So if you
104 set this to 87, the first page would say "87" on it, the next "88",
105 and so on.
106
107 NoProlog
108 If this option is set to a true value, HTML::FormatPS will make a
109 point of not emitting the PostScript prolog before the document. By
110 default, this is off, meaning that HTML::FormatPS will emit the
111 prolog. This option is of interest only to advanced users.
112
113 NoTrailer
114 If this option is set to a true value, HTML::FormatPS will make a
115 point of not emitting the PostScript trailer at the end of the
116 document. By default, this is off, meaning that HTML::FormatPS will
117 emit the bit of PostScript that ends the document. This option is
118 of interest only to advanced users.
119
121 new
122 my $formatter = FormatterClass->new(
123 option1 => value1, option2 => value2, ...
124 );
125
126 This creates a new formatter object with the given options.
127
129 HTML::Formatter
130
132 · Output is in ISO Latin1 format. The underlying HTML parsers tend to
133 now work in Unicode (perl native) code points. There is an
134 impedance mismatch between these, which may give issues with
135 complex characters within HTML.
136
138 · Support for some more character styles, notably including: strike-
139 through, underlining, superscript, and subscript.
140
141 · Support for Unicode.
142
143 · Support for Win-1252 encoding, since that's what most people mean
144 when they use characters in the range 0x80-0x9F in HTML.
145
146 · And, if it's ever even reasonably possible, support for tables.
147
148 I would welcome email from people who can help me out or advise me on
149 the above.
150
152 See perlmodinstall for information and options on installing Perl
153 modules.
154
156 No bugs have been reported.
157
158 Please report any bugs or feature requests through the web interface at
159 <http://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Format>.
160
162 The project homepage is <http://search.cpan.org/dist/HTML-Format>.
163
164 The latest version of this module is available from the Comprehensive
165 Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find
166 a CPAN site near you, or see
167 <http://search.cpan.org/dist/HTML-Format/>.
168
169 The development version lives at <http://github.com/nigelm/html-format>
170 and may be cloned from <git://github.com/nigelm/html-format.git>.
171 Instead of sending patches, please fork this project using the standard
172 git and github infrastructure.
173
175 · Nigel Metheringham <nigelm@cpan.org>
176
177 · Sean M Burke <sburke@cpan.org>
178
179 · Gisle Aas <gisle@ActiveState.com>
180
182 This software is copyright (c) 2011 by Nigel Metheringham, 2002-2005
183 Sean M Burke, 1999-2002 Gisle Aas.
184
185 This is free software; you can redistribute it and/or modify it under
186 the same terms as the Perl 5 programming language system itself.
187
188
189
190perl v5.16.3 2014-06-10 HTML::FormatPS(3)