[PyKDE] Printing using QPrinter

Fabian Steiner lists at fabis-site.net
Mon Mar 6 20:18:36 GMT 2006


Hello!

David Boddie wrote:
>> body is the border of the whole page, the other objects should be placed
>> in it, but I don't know how to position the other elements. Of course, I
>> can pass the appropriate x, y values to QPainter.drawText(), but it
>> means a lot of work to get them for about 25 elements.
>>     
>
> This is where you should probably use the text layout facilities provided
> by Qt. In Qt 3, it looks like the best way to do this is with QTextEdit or
> QTextBrowser to display the text, and by using QSimpleRichText with
> QPrinter to print it.
>
> I thought it might be a worthwhile learning experience to prototype
> something that does a little of what you want, and put it up on the
> PyQt Wiki:
>
> http://www.diotavelli.net/PyQtWiki/Printing_a_Worksheet
>
> Feel free to update it so that others can benefit from your experience.
>
> Have fun,
>
> David
>
>   

Sorry for my late reply, but I was quite busy learning for school this 
weekend ...
Due to your previous hints, however,  I was able to solve my printing 
problem almost the same way as you did it.

The Wiki seems rather interesting, I think I am going to add something 
the next days ;-)

Cheers,
Fabian Steiner




More information about the PyQt mailing list