printing HTML or PDF from Python

Jorgen Grahn jgrahn-nntq at algonet.se
Wed Oct 27 04:20:49 EDT 2004


On Tue, 26 Oct 2004 12:14:45 -0400, Peter Hansen <peter at engcorp.com> wrote:
> Donnal Walter wrote:
>> os.system("copy some.txt LPT1")
>> And as expected, using this function with "some.html" simply prints the 
>> html source. 
> 
> That's of course because the printer knows how to handle "raw" text
> without further help.  As you surmised, anything more complicated
> needs either native support (e.g. Postscript can be sent to a
> Postscript printer naturally), or an application to be launched
> to interpret the file and "draw" it for the printer.

Or a print spooler daemon, which is the normal case on Unix. The user is
supposed to know what formats are supported by a specific spool, and only
send those into the spool. Postscript is the traditional lingua franca, but
I guess many Linux and other systems support PDF today. All this have
nothing to do with what the printer supports.

...
> I don't think you'll find a cross-platform approach to handle
> all your needs, but there are a few options.  The only one
> that I'm familiar with at all would be using ActiveX to
> control IE (for HTML files) and Acrobat Reader (for PDF)
> through the documented interfaces.  From Python it's not

But that's not very cross-platform, is it?
I know of no cross-platform way :-/

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list