GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::FormatPS(3) User Contributed Perl Documentation HTML::FormatPS(3)

HTML::FormatPS - Format HTML as PostScript

version 2.12

    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',
    );

The HTML::FormatPS is a formatter that outputs PostScript code. Formatting of HTML tables and forms is not implemented.

HTML::FormatPS is built on top of HTML::Formatter and 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 is "A4".

PaperWidth
The width of the paper, in points. Setting PaperSize also defines this value.
PaperHeight
The height of the paper, in points. Setting PaperSize also 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 is 4 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 is 2 cm,
PageNo
This parameter determines if we should put page numbers on the pages. The default value is true; so you have to set this value to 0 in order to suppress page numbers. (The "No" in "PageNo" means number/numero!)
FontFamily
This parameter specifies which family of fonts to use for the formatting. Legal values are "Courier", "Helvetica" and "Times". The default is "Times".
FontScale
This is a scaling factor for all the font sizes. The default value is 1.

For example, if you want everything to be almost three times as large, you could set this to 2.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 is space between lines. This is a factor of the font size used for that line. Default is 0.1 -- so between two 12-point lines, there will be 1.2 points of space.
StartPage
Assuming you have PageNo on, StartPage controls what the page number of the first page will be. By default, it is 1. So if you set this to 87, 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::FormatPS will make a point of not emitting the PostScript prolog before the document. By default, this is off, meaning that HTML::FormatPS will emit the prolog. This option is of interest only to advanced users.
NoTrailer
If this option is set to a true value, HTML::FormatPS will make a point of not emitting the PostScript trailer at the end of the document. By default, this is off, meaning that HTML::FormatPS will emit the bit of PostScript that ends the document. This option is of interest only to advanced users.

    my $formatter = FormatterClass->new(
        option1 => value1, option2 => value2, ...
    );

This creates a new formatter object with the given options.

HTML::Formatter

Output is in ISO Latin1 format. 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.

  • Support for some more character styles, notably including: strike-through, underlining, superscript, and subscript.
  • Support for Unicode.
  • Support for Win-1252 encoding, since that's what most people mean when they use characters in the range 0x80-0x9F in HTML.
  • And, if it's ever even reasonably possible, support for tables.

I would welcome email from people who can help me out or advise me on the above.

See perlmodinstall for information and options on installing Perl modules.

You can make new bug reports, and view existing ones, through the web interface at <http://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Format>.

The project homepage is <https://metacpan.org/release/HTML-Format>.

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you, or see <https://metacpan.org/module/HTML::Format/>.

  • Nigel Metheringham <nigelm@cpan.org>
  • Sean M Burke <sburke@cpan.org>
  • Gisle Aas <gisle@ActiveState.com>

This software is copyright (c) 2015 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.

2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.