HTML::FormatPS(3)
β¨ NAME β¨
okay bestie, welcome to HTML::FormatPS(3) from the User Contributed Perl Documentation π β yes, the page for HTML::FormatPS - Format HTML as PostScript. it's giving βturn HTML into PostScript,β and we're obsessed π.
π¦ VERSION π¦
version 2.16 β periodt.
πΈ SYNOPSIS πΈ
bestie, here's the whole vibe in code:
use HTML::TreeBuilder;
$tree = HTML::TreeBuilder->new->parse_file("test.html");
use HTML::FormatPS;
$formatter = HTML::FormatPS->new(
FontFamily => 'Helvetica',
PaperSize => 'Letter',
);
print $formatter->format($tree);
Or, for short:
use HTML::FormatPS;
print HTML::FormatPS->format_file(
"test.html",
'FontFamily' => 'Helvetica',
'PaperSize' => 'Letter',
);
π DESCRIPTION π
HTML::FormatPS is a formatter that outputs PostScript code.
heads up, bestie: formatting of HTML tables and forms is not implemented.
HTML::FormatPS is built on top of HTML::Formatter, so further detail may be found in the documentation for HTML::Formatter π.
You might specify the following parameters when constructing the formatter object (or when calling format_file or format_string):
PaperSizeβ what kind of paper should we format for? the value can be one of these:A3,A4,A5,B4,B5,Letter,Legal,Executive,Tabloid,Statement,Folio,10x14,Quarto. the default isA4β¨.PaperWidthβ the width of the paper, in points. settingPaperSizealso defines this value π.PaperHeightβ the height of the paper, in points. settingPaperSizealso defines this value π.LeftMarginβ the left margin, in points.RightMarginβ the right margin, in points.HorizontalMarginβ both left and right margin at the same time. the default value is4 cmπ«Ά.TopMarginβ the top margin, in points.BottomMarginβ the bottom margin, in points.VerticalMarginβ both top and bottom margin at the same time. the default value is2 cmπ«Ά.PageNoβ this parameter determines if we should put page numbers on the pages. the default value istrue; so you have to set this value to0in order to suppress page numbers. (theNoinPageNomeans number/numero!) π’FontFamilyβ this parameter specifies which family of fonts to use for the formatting. legal values areCourier,HelveticaandTimes. the default isTimesπ€.FontScaleβ this is a scaling factor for all the font sizes. the default value is1. for example, if you want everything to be almost three times as large, you could set this to2.7. if you wanted things just a bit smaller than normal, you could set it to.92π.Leadingβ this option (pronounced ledding, not leeding) controls how much space is between lines. this is a factor of the font size used for that line. default is0.1-- so between two12-pointlines, there will be1.2points of space π.StartPageβ assuming you havePageNoon,StartPagecontrols what the page number of the first page will be. by default, it is1. so if you set this to87, the first page would say"87"on it, the next"88", and so on π’.NoPrologβ if this option is set to a true value,HTML::FormatPSwill make a point of not emitting the PostScript prolog before the document. by default, this is off, meaning thatHTML::FormatPSwill emit the prolog. this option is of interest only to advanced users π§ .NoTrailerβ if this option is set to a true value,HTML::FormatPSwill make a point of not emitting the PostScript trailer at the end of the document. by default, this is off, meaning thatHTML::FormatPSwill emit the bit of PostScript that ends the document. this option is of interest only to advanced users π§ .
π οΈ METHODS π οΈ
π« new π«
my $formatter = FormatterClass->new(
option1 => value1, option2 => value2, ...
);
This creates a new formatter object with the given options β that's the whole method, bestie π«Ά.
π SEE ALSO π
HTML::Formatter β go read that one too, bestie π.
π ISSUES π
- Output is in
ISO Latin1format. The underlying HTML parsers tend to now work in Unicode (perl native) code points. There is an impedance mismatch between these, which may give issues with complex characters within HTML.
π₯ TO DO π₯
- Support for some more character styles, notably including: strike-through, underlining, superscript, and subscript.
- Support for Unicode.
- Support for
Win-1252encoding, since that's what most people mean when they use characters in the range0x80-0x9Fin HTML. - And, if it's ever even reasonably possible, support for tables.
and fr, I would welcome email from people who can help me out or advise me on the above π«Ά.
π AUTHORS π
Nigel Metheringham <nigelm@cpan.org>β icon β¨Sean M Burke <sburke@cpan.org>β icon β¨Gisle Aas <gisle@ActiveState.com>β icon β¨
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2016 by Nigel Metheringham, 2002-2005 Sean M Burke, 1999-2002 Gisle Aas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
mwah π that's the whole page, bestie β it came from perl v5.40.2, dated 2023-07-03, and it's the HTML::FormatPS(3) page. bye slay π¦
π¦ where this page comes from
- alpine 3.22: perl-html-formatter-doc 2.16-r3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms