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