1HTML::FormatPS(3) User Contributed Perl Documentation HTML::FormatPS(3)
2
3
4
6 HTML::FormatPS - Format HTML as PostScript
7
9 version 2.16
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 • Nigel Metheringham <nigelm@cpan.org>
153
154 • Sean M Burke <sburke@cpan.org>
155
156 • Gisle Aas <gisle@ActiveState.com>
157
159 This software is copyright (c) 2016 by Nigel Metheringham, 2002-2005
160 Sean M Burke, 1999-2002 Gisle Aas.
161
162 This is free software; you can redistribute it and/or modify it under
163 the same terms as the Perl 5 programming language system itself.
164
165
166
167perl v5.34.0 2021-07-22 HTML::FormatPS(3)