[plug] printing html files from the command line (a2ps??)
James Devenish
devenish at guild.uwa.edu.au
Fri Jul 25 13:44:31 WST 2003
Hi,
Some more points to consider:
In message <courier.3F20BF98.0000546E at wasp.net.au>
on Fri, Jul 25, 2003 at 01:26:48PM +0800, David Buddrige wrote:
> I have a bunch of html files that I want to print. Rather than opening
> each of them in turn with my web-browser and choosing File - Print, I'd
> like to script it.
Just to be specific: we can safely assume that you are talking about
rendered HTML, rather than the HTML source. But, can we assume you want
graphical rendering rather than text-only rendering? Probably, even
though the answer is simpler for text-only rendering. Remember: there
is no single "correct" rendering of an HTML file, so results will vary
with each renderer.
> I have tried a2ps to see if I could use that to print html; in which
> case it would be a fairly straightforward script to loop through each
> html file and call a2ps on it.
Sounds great in principle. Some print spoolers can (or can be configured
to) handle this sort of thing for you, so that you can use `lp
blah.txt`, `lp blah.html`, or `lp blah.pdf` and get an
intuitively-correct printout.
> If I use the a2ps command to
> print out a .html file, will it print the html source, or will it print the
> display one would see if you viewed the .html file with a web-browser?
Looks like you copy of a2ps was *trying* to display the rendered HTML
but wasn't able to open a renderer. In the a2ps man page, this is called
"delegation" (i.e. it is designed to be able to do this for you). Note
that most textual browsers (w3m, lynx, at least) will render HTML pages
to text for you, and it is easy enough to dump that to a printer. For
graphical rendering, the principal is probably the same but it will need
to use an X11 server.
The a2ps man page looks pretty good and the table of contents for the
"info" manual looks pretty comprehensive. Try `info a2ps` for details.
> [buddrid at mit243linux ~/java/beans]$ a2ps Beans.html
> netscape-communicator: root window has no children on display :0.0
> [Beans.html (html, delegated to Netscape): failed. Ignored]
> [No output produced]
Looks like netscape-communicator was invoked to render your HTML page
but didn't get the right DISPLAY or didn't manage to open the HTML file
for some reason. I'm not entirely sure.
More information about the plug
mailing list