1HTML::FormatPS(3) User Contributed Perl Documentation HTML::FormatPS(3)
2
3
4
6 HTML::FormatPS - Format HTML as PostScript
7
9 use HTML::TreeBuilder;
10 $tree = HTML::TreeBuilder->new->parse_file("test.html");
11
12 use HTML::FormatPS;
13 $formatter = HTML::FormatPS->new(
14 FontFamily => 'Helvetica',
15 PaperSize => 'Letter',
16 );
17 print $formatter->format($tree);
18
19 Or, for short:
20
21 use HTML::FormatPS;
22 print HTML::FormatPS->format_file(
23 "test.html",
24 'FontFamily' => 'Helvetica',
25 'PaperSize' => 'Letter',
26 );
27
29 The HTML::FormatPS is a formatter that outputs PostScript code. For‐
30 matting of HTML tables and forms is not implemented.
31
32 You might specify the following parameters when constructing the for‐
33 matter object (or when calling format_file or format_string):
34
35 PaperSize
36 What kind of paper should we format for. The value can be one of
37 these: A3, A4, A5, B4, B5, Letter, Legal, Executive, Tabloid,
38 Statement, Folio, 10x14, Quarto.
39
40 The default is "A4".
41
42 PaperWidth
43 The width of the paper, in points. Setting PaperSize also defines
44 this value.
45
46 PaperHeight
47 The height of the paper, in points. Setting PaperSize also defines
48 this value.
49
50 LeftMargin
51 The left margin, in points.
52
53 RightMargin
54 The right margin, in points.
55
56 HorizontalMargin
57 Both left and right margin at the same time. The default value is
58 4 cm.
59
60 TopMargin
61 The top margin, in points.
62
63 BottomMargin
64 The bottom margin, in points.
65
66 VerticalMargin
67 Both top and bottom margin at the same time. The default value is
68 2 cm,
69
70 PageNo
71 This parameter determines if we should put page numbers on the
72 pages. The default value is true; so you have to set this value to
73 0 in order to suppress page numbers. (The "No" in "PageNo" means
74 number/numero!)
75
76 FontFamily
77 This parameter specifies which family of fonts to use for the for‐
78 matting. Legal values are "Courier", "Helvetica" and "Times". The
79 default is "Times".
80
81 FontScale
82 This is a scaling factor for all the font sizes. The default value
83 is 1.
84
85 For example, if you want everything to be almost three times as
86 large, you could set this to 2.7. If you wanted things just a bit
87 smaller than normal, you could set it to .92.
88
89 Leading
90 This option (pronounced "ledding", not "leeding") controls how much
91 is space between lines. This is a factor of the font size used for
92 that line. Default is 0.1 -- so between two 12-point lines, there
93 will be 1.2 points of space.
94
95 StartPage
96 Assuming you have PageNo on, StartPage controls what the page num‐
97 ber of the first page will be. By default, it is 1. So if you set
98 this to 87, the first page would say "87" on it, the next "88", and
99 so on.
100
101 NoProlog
102 If this option is set to a true value, HTML::FormatPS will make a
103 point of not emitting the PostScript prolog before the document. By
104 default, this is off, meaning that HTML::FormatPS will emit the
105 prolog. This option is of interest only to advanced users.
106
107 NoTrailer
108 If this option is set to a true value, HTML::FormatPS will make a
109 point of not emitting the PostScript trailer at the end of the doc‐
110 ument. By default, this is off, meaning that HTML::FormatPS will
111 emit the bit of PostScript that ends the document. This option is
112 of interest only to advanced users.
113
115 HTML::Formatter
116
118 · Support for some more character styles, notably including:
119 strike-through, underlining, superscript, and subscript.
120
121 · Support for Unicode.
122
123 · Support for Win-1252 encoding, since that's what most people mean
124 when they use characters in the range 0x80-0x9F in HTML.
125
126 · And, if it's ever even reasonably possible, support for tables.
127
128 I would welcome email from people who can help me out or advise me on
129 the above.
130
132 Copyright (c) 1995-2002 Gisle Aas, and 2002- Sean M. Burke. All rights
133 reserved.
134
135 This library is free software; you can redistribute it and/or modify it
136 under the same terms as Perl itself.
137
138 This program is distributed in the hope that it will be useful, but
139 without any warranty; without even the implied warranty of mer‐
140 chantability or fitness for a particular purpose.
141
143 Current maintainer: Sean M. Burke <sburke@cpan.org>
144
145 Original author: Gisle Aas <gisle@aas.no>
146
147
148
149perl v5.8.8 2004-06-02 HTML::FormatPS(3)