[Kde-print-devel] Printing: KPrintPreview

Alex Merry huntedhacker at tiscali.co.uk
Mon Sep 24 17:10:44 CEST 2007


I have here a working KPrintPreview class.  It's a KDialog, and is used 
as follows:

QPrinter printer;
KPrintPreview preview(&printer, this); // where "this" is a QWidget
doSomePrinting(printer);
preview.exec();

Basically, you use it almost identically to a QPrintDialog, except that 
you exec() the dialog after you've done the printing rather than 
before.

It uses any available KPart that advertises that it can deal with 
application/pdf (eg: Okular).  Note that I had to delete the kghostview 
desktop file to make this work, since kghostview is broken for me.

It was quite straightforward to adapt kolourpaint to use QPrinter and 
KPrintPreview, for testing.

I temporarily named the library kdeprint2, so as not to interfere with 
kdeprint.

Attached are a patch for kdelibs and the modifications I made to get 
kolourpaint to work.

Obviously the class could be made better in various ways, but it 
demonstrates a working print preview and an API for it.

Alex


PS: please keep discussions about the printing dialog in a separate 
thread, unless they directly relate to print preview.


-- 
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kolourpaint-kdeprint2.diff
Type: text/x-diff
Size: 6912 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-print-devel/attachments/20070924/20496a79/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdeprint2.diff
Type: text/x-diff
Size: 9406 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-print-devel/attachments/20070924/20496a79/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-print-devel/attachments/20070924/20496a79/attachment.pgp 


More information about the Kde-print-devel mailing list