HTML::FormatPS
The HTML::FormatPS module converts an HTML parse tree
into PostScript. The formatter object is created with the new
constructor, which can take parameters
that assign PostScript attributes. For example:
$formatter = HTML::FormatPS->new('papersize' => 'Letter');
You can now give parsed HTML to the formatter and produce PostScript output for printing. HTML::FormatPS does not handle table or form elements at this time.
The method for this class is format
. format
takes a reference to an HTML
TreeBuilder object, representing a parsed HTML document. It returns
a scalar containing the document formatted in PostScript. The
following example shows how to use this module to print a file in
PostScript:
use HTML::FormatPS; $html = HTML::TreeBuilder->parse_file(somefile); $formatter = HTML::FormatPS->new( ); print $formatter->format($html);
The following list describes the attributes that can be set in the constructor:
PaperSize
Possible values are
3
,A4
,A5
,B4
,B5
,Letter
,Legal
,Executive
,Tabloid
,Statement
,Folio
,10x14
, andQuarto
. The default isA4
.PaperWidth
Width of the paper in points.
PaperHeight
Height of the paper in points.
LeftMargin
Left margin in points.
RightMargin
Right margin in points.
HorizontalMargin
Left and right margin. Default is 4 cm.
TopMargin
Top margin in points.
BottomMargin
Bottom margin in points.
VerticalMargin
Top and bottom margin. Default is 2 cm.
PageNo
Boolean value to display page numbers. Default is
0
(off).FontFamily
Font family to use on the page. Possible ...
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.