Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: formatting web pages for a printer

by Hero Zzyzzx (Curate)
on Aug 27, 2002 at 15:31 UTC ( #193194=note: print w/replies, xml ) Need Help??


in reply to formatting web pages for a printer

Look at HTMLdoc as an EXCELLENT server-side html to pdf converter. It's open-source, very fast, free, and generates very, very good output. I can't say enough good things about it. I'd be happy to send you links to sample output, if you wish. (pm me).

If you've taken the wise step of separating presentation from content and logic using modules like HTML:Template, then you can also create a "printable" template that nixes all your graphics and wraps the content in 650 pixel width table. This table width seems to avoid lines being cut off on most browsers. This can be a less desirable option, depending on the nature of the content you're serving.

Update: Spelling fix and added second paragraph.

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

Replies are listed 'Best First'.
Re: Re: formatting web pages for a printer
by markjugg (Curate) on Aug 27, 2002 at 15:40 UTC
    HTMLdoc does look like an excellent solution for a lot of cases. It looks it's been ported to FreeBSD as well. However, it failed my "quick probe" test with the demo provided, by cutting off a wide table instead of shrinking it to web page, or at least creating a second page in the PDF. Maybe that particular issue could be worked out by stricter HTML formatting, or some HTMLdoc configuration option...

    It's not perfect, but it appears to be better than anything I've found. :) Thanks.

    -mark

      Hmm. I haven't run into that issue yet mainly because I think fixed tables suck and should be avoided whenever possible. I assume that this wide table was a fixed width table?

      One other tip- I create an HTMLdoc specific template that I then use as the "base" page for pdf conversion- this allows you to ixnay the frivolous (sp?) graphics, leaving only the good stuff. This is a trivial operation if you have everything in a templatting system.

      HTMLdoc has an enormous amount of configuration options, I'd be surprised if you weren't able to tweak it to fix your problem on a system-wide basis.

      -Any sufficiently advanced technology is
      indistinguishable from doubletalk.

        I found that htmldoc does document this, and appears to have a fix-- I can set this option higher:
        --browserwidth
        The default browser width is 680 pixels which corresponds roughly to a 96 DPI display. Please note that your images and table sizes are equal to or smaller than the browser width, or your output will overlap or truncate in places.
        update: I found out the current version, 1.8.20, doesn't support printing html that appears inside of form related tags, such as input and textarea

        -mark

      If it's a pixel-fixed-width table you can fix this by passing a --browserwidth parameter to htmldoc that's greater than the total width of the table.

      .

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://193194]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-12-12 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (57 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!