print rendered HTML via CLI

Kurt Pfeifle kurt.pfeifle at infotec.com
Fri Jun 15 12:06:10 PDT 2007


> I'm wondering if anyone is able to print rendered HTML via command line.
> If I print an HTML file using lp it just prints the code. Is there a
> filter that I am missing?

CUPS has no built-in filter that would convert your rendered HTML into PostScript. CUPS sees your HTML source code as ASCII text and prints it like that.

I'd recommend you to install HTMLDOC (written by the same cool developer who created CUPS). Either your distro has packages or you'll have to grab the source from http://www.easysw.com/htmldoc/ and compile it yourself.

HTMLDOC can convert your HTML into PDF or PostScript. Once you have HTMLDOC, it is relatively easy to write a wrapper script that conforms to the CUPS conventions to act as a CUPS filter.

(There is also a tool called "html2ps" out there, which may be sufficient for your purpose; it may be possible to do a simple

   html2ps some.html | lp -d your_printer -

and get an acceptable result.)




More information about the cups mailing list