no simple way to print a QTextDocument in KDE(?)

Andreas Hartmetz ahartmetz at gmail.com
Thu Jul 26 10:32:15 BST 2007


On Thursday 26 July 2007 04:06:53 Cristian Tibirna wrote:
> On 24 July 2007 20:40, Andreas Hartmetz wrote:
> > Can somebody familiar with the matter think of a solution that works
> > now, or how much stuff would need to be changed to make it work?
> > One solution might be a KTextDocument that just reimplements print(),
> > for example. Or KPrinter::printTextDocument() [...]
>
> Why not simply printing to a PostScript stream (in memory or on disk) using
> QPrinter then sending *that* to KPrinter?

You can set up many things in KPrinter that change the output, but once you 
have a PostScript file / stream (file in that case, QPrinter doesn't output 
streams) the layout is fixed.
The next try, then, is to use a KPrinter for setup, transfer its settings to a 
QPrinter, print to that, and feed its output to KPrinter again. That would 
break the preview, probably.
For the record, there are QTextDocument::draw() and 
QTextDocumentLayout::draw() for intermediate to high level printing, and it 
looks I'm going to use them instead.

-- 
A stocking full of ammo! He's a santa for the nineties!




More information about the kde-core-devel mailing list