Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Using script to print out a html file

by Anonymous Monk
on Jul 31, 2000 at 07:28 UTC ( #25201=categorized question: print w/replies, xml ) Need Help??
Contributed by Anonymous Monk on Jul 31, 2000 at 07:28 UTC
Q&A  > CGI programming


I am not sure whether its possible.
The script i want to create is one that is able to print
the html file, not the source code but the output i will
see on my browser.


Answer: Using script to print out a html file
contributed by ColtsFoot

If you just want yo see the text that is contained
in your HTML then you could try parsing your document
using HTML::Parser

$p = HTML::Parser->new(); $p->parse_file('Your_html.html');
and then use HTML::FormattedText and the format method to
get your output. Hope this is of help
Answer: Using script to print out a html file
contributed by Corion

It is in general a quite hard task to render HTML like "your" browser, as many browsers have quite different opinions on how to "correctly" render HTML. There are modules that do this for Perl, like HTML::Format, that can produce Postscript or ASCII text from HTML source, but if you want something in the quality of IE 5, supporting frames etc., you have to use IE 5 to print it.

In general, Perl is the wrong hammer for this nail.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (4)
    As of 2020-08-03 12:55 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (27 votes). Check out past polls.