1HTML::FormatRTF(3) User Contributed Perl Documentation HTML::FormatRTF(3)
2
3
4
6 HTML::FormatRTF - Format HTML as RTF
7
9 use HTML::FormatRTF;
10
11 my $out_file = "test.rtf";
12 open(RTF, ">$out_file")
13 or die "Can't write-open $out_file: $!\nAborting";
14
15 print RTF HTML::FormatRTF->format_file(
16 'test.html',
17 'fontname_headings' => "Verdana",
18 );
19 close(RTF);
20
22 HTML::FormatRTF is a class for objects that you use to convert HTML to
23 RTF. There is currently no proper support for tables or forms.
24
25 This is a subclass of HTML::Formatter, whose documentation you should
26 consult for more information on the new, format, format_file
27
28 You can specify any of the following parameters in the call to "new",
29 "format_file", or "format_string":
30
31 lm Amount of extra indenting to apply to the left margin, in twips
32 (twentieths of a point). Default is 0.
33
34 So if you wanted the left margin to be an additional half inch
35 larger, you'd set "lm => 720" (since there's 1440 twips in an
36 inch). If you wanted it to be about 1.5cm larger, you'd set "lw =>
37 850" (since there's about 567 twips in a centimeter).
38
39 rm Amount of extra indenting to apply to the left margin, in twips
40 (twentieths of a point). Default is 0.
41
42 normal_halfpoint_size
43 This is the size of normal text in the document, in half-points.
44 The default value is 22, meaning that normal text is in 11 point.
45
46 header_halfpoint_size
47 This is the size of text used in the document's page-header, in
48 half-points. The default value is 17, meaning that normal text is
49 in 7.5 point. Currently, the header consists just of "p.pagenum‐
50 ber" in the upper-right-hand corner, and cannot be disabled.
51
52 head1_halfpoint_size ... head6_halfpoint_size
53 These control the font size of each heading level, in half-twips.
54 For example, the default for head3_halfpoint_size is 25, meaning
55 that HTML "<h3>...</h3>" text will be in 12.5 point text (in addi‐
56 tion to being underlined and in the heading font).
57
58 codeblock_halfpoint_size
59 This controls the font size (in half-points) of the text used for
60 "<pre>...</pre>" text. By default, it is 18, meaning 9 point.
61
62 fontname_body
63 This option controls what font is to be used for the body of the
64 text -- that is, everything other than heading text and text in
65 pre/code/tt elements. The default value is currently "Times".
66 Other handy values I can suggest using are "Georgia" or "Bookman
67 Old Style".
68
69 fontname_code
70 This option controls what font is to be used for text in
71 pre/code/tt elements. The default value is currently "Courier New".
72
73 fontname_headings
74 This option controls what font name is to be used for headings.
75 You can use the same font as fontname_body, but I prefer a sans-
76 serif font, so the default value is currently "Arial". Also con‐
77 sider "Tahoma" and "Verdana".
78
79 document_language
80 This option controls what Microsoft language number will be speci‐
81 fied as the language for this document. The current default value
82 is 1033, for US English. Consult an RTF reference for other lan‐
83 guage numbers.
84
85 hr_width
86 This option controls how many underline characters will be used for
87 rendering a "<hr>" tag. Its default value is currently 50. You can
88 usually leave this alone, but under some circumstances you might
89 want to use a smaller or larger number.
90
91 no_prolog
92 If this option is set to a true value, HTML::FormatRTF will make a
93 point of not emitting the RTF prolog before the document. By
94 default, this is off, meaning that HTML::FormatRTF will emit the
95 prolog. This option is of interest only to advanced users.
96
97 no_trailer
98 If this option is set to a true value, HTML::FormatRTF will make a
99 point of not emitting the RTF trailer at the end of the document.
100 By default, this is off, meaning that HTML::FormatRTF will emit the
101 bit of RTF that ends the document. This option is of interest only
102 to advanced users.
103
105 HTML::Formatter, RTF::Writer
106
108 Copyright (c) 2002 Sean M. Burke. All rights reserved.
109
110 This library is free software; you can redistribute it and/or modify it
111 under the same terms as Perl itself.
112
113 This program is distributed in the hope that it will be useful, but
114 without any warranty; without even the implied warranty of mer‐
115 chantability or fitness for a particular purpose.
116
118 Sean M. Burke "<sburke@cpan.org>"
119
120
121
122perl v5.8.8 2004-06-02 HTML::FormatRTF(3)