[PyQt] pdf print

Håvard Gulldahl havard at lurtgjort.no
Mon Mar 2 10:40:14 GMT 2009


Hi Nahuel, list,


On Thu, Feb 26, 2009 at 10:41 PM, Nahuel Defossé
<nahueldefosse at yahoo.com.ar> wrote:
> Hi
> I've created pdf output in a StringIO file which I'd like to print in my PyQt4
> app. Should I save it and send it to the system default reader? or could I
> automate this task? Is it possible to pirnt the file directly from PyQt?


Like Jim Bublitz, I'm using reportlab to generate pdf invoices.
Instead of mucking around with printers and such I open the file in a
pdf reader, using subprocess.call().

That way I also get a sort of print preview for free, and it works
with the same code on linux and windows.

I'm happy with that, although I did have some issues with file name
encoding on windows. Hat tip: encode the command string with
sys.getfilesystemencoding(), else it will blow up on windows.

Take care,

Håvard

-- 
Håvard Gulldahl <havard at gulldahl.no>



More information about the PyQt mailing list