tags:

views:

85

answers:

3

Hi,

I'm looking for some API for printing.

Basically what I want to achieve is to print set of pixels(monochromatic bitmap which I store in memory) onto the generic paper format (A4,A5..etc.).

What I think that would be minimum API is:

  • printer devices list
  • printer buffer where I could send my in-memory pixmap (ex. like winXP printer tasks folder)
  • some API which would translate SI dimensions onto printer resolution, or according to previous - in memory pixmap (ex. 450x250) onto paper in appropriate resolution.

What I was considering is postScript, but I've some old LPT drived laserjet which probably doesn't support *PS.

Currently I'm trying to find something interesting in Qt - QGraphicsView.

http://doc.trolltech.com/4.2/qgraphicsview.html

A: 

You might want to investigate wx python for printing. Learning the framework might be a bit of an overhead for you though! I've had success with that in the past, both on windows and linux.

I've also used reportlab to make PDFs which are pretty easy to print using the minimum of OS interaction.

Nick Craig-Wood
A: 

I would use PIL to create a BMP file, and then just use the standard OS services to print that file. PIL will accept data in either raster or vector form.

Paul McGuire
A: 

Well you got close, look at Printing in Qt. There is the QPrinter class that implements some of what you are looking for. It is implmenetent as a QPaintDevice. This means that any widget that can render itself on the screen can be printed. This also mean you don't need to render to a bitmap to print, you can use Qt widgets or drawing functions for printing

On a side note, check the version number of the Qt documentation, the last release of Qt is 4.5, 4.6 is in beta.

Harald Scheirich