[reportlab-users] Re: printing from python

Henning von Bargen H.vonBargen at t-p.com
Wed Dec 14 03:12:18 EST 2005

> Message: 1
> Date: Mon, 12 Dec 2005 21:54:51 -0500
> From: "David Pannell" <dcpx2 at msn.com>
> Subject: [reportlab-users] printing from python
> To: reportlab-users at reportlab.com
> Message-ID: <BAY115-F31C2667F694DB5B3074587F8390 at phx.gbl>
> Content-Type: text/plain; format=flowed
> I'm an amateur who is developing some small database software 
> for a small 
> business.  Love reportlab.  One question, and this is driving 
> me crazy, "How 
> can I print the pdf I have generated without manually opening 
> adobe and 
> pressing print?"  I want to generate the pdf, print it from 
> my python app 
> and be done.  Please help.  I'm going crazier than usual.  
> Thanks so much
> david
> There are some WIN32 specific ideas documented nicely at this site:
> http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html
> Hope they are usefull
> Mark Doukidis

Printing PDFs on MS Windows is not as easy as it seems.
We found ShellExecute not to be reliable with Adobe Reader:
sometimes output gets lost, and the Adobe Reader window
stays open.
And the support for DDE and/or COM is shrinking with each
new revision of Adobe Reader.

For our own application, we evaluated four possible solutions.
a) controlling the Adobe Reader user interface.
b) using GhostScript
c) using a commercial tool (pdprint from www.pdf-tools.ch)
d) ShellExecute with Adobe Reader

All of these have their pros and cons.
a) In our tests, we found it works reliable (to our surprise).
But it depends on the exact AR version and language you are using,
and we just don't trust it really.
b) GhostScript is the "standard" solution.
But GPL GhostScript still has quite a bunch of flaws that make
using it complicated, namely images on PCL printers,
landscape on the mswinpr2 device, print speed on mswinpr2,
printing non-standard size PDFs (i.e. labels), and choosing the
correct device at all.
However, once setup it works well at least for HP and PostScript printers
(not so well for non-PS-cheapo*-printers).
c) Is very fast and works well, but of course you have to pay for using it.
d) Did not work in a reliable fashion, output gets lost sometimes.


* a tribute to the great Benny Hill

More information about the reportlab-users mailing list