[python-win32] Question about printing through IE

Tim Roberts timr at probo.com
Fri Mar 24 18:39:44 CET 2006


On Thu, 23 Mar 2006 14:19:45 +0200, "Jason Robinson" <jaywink at gmail.com>
wrote:

>Being relatively new to Python (and no advanced programmer anyhow) I have a
>question..
>
>For a work related program I need my Python script to be able to change
>printer settings in IE before printing. I have a script which creates an
>HTML file with images and text and it uses the ShellExecute approach to
>print it to a printer (using IE obviously). Only problem is I need it to
>access the IE printing settings directly and modify them before printing
>(margins etc etc). I've searched the web throughout but can't figure out
>where to start...
>
>Any hints on what I should do?
>


There is actually very little you can do.  It's improper to rely on
precise rendering in a web browser to begin with.  HTML is not a page
description language; you just don't have that much control over
layout.  You describe roughly how it should look, and the browser does
its best to present it.  The layout might change with the next version
of IE; it has certainly happened before.

If you need to print something so that it looks the same on every
printer, use ReportLab and create a PDF.

Alternatively, you can convert your app to wxPython, which has a
wxHtmlEasyPrinting module built in.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list