Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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.


      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:
        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


      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?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2021-05-13 05:57 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (134 votes). Check out past polls.