[Kde-print-devel] [Bug 124317] JJ: Use kdpf to show the documentprinted to a PDF file

Goffioul Michael goffioul at imec.be
Wed Jul 4 14:42:17 CEST 2007


> A beta patch is ready but i am still having problems with 
> opening the .pdf afterwards. When finishPrinting in KPrinter 
> is called the output .pdf still does not exist. So we have to 
> sleep before we open the .pdf (with KRun for example). I am 
> currently using KRun::runCommand("sleep 1 && kfmclient exec " 
> + outputFileName()). But there really has to be a better way.

Indeed, this is not a good way as you don't know when the file
will be ready and you don't know if the file generation succeeded.
Why don't you handle this in the kdeprintd module: this module is
responsible for running the print command in the background and
controlling the associated process; from there you know when the
file will be ready and if the process succeeded.

See kdeprintd.[cpp|h], kprinterimpl.cc (KPrinterImpl::dcopPrint).
You can imagine to add an argument to the "print" method of kdeprintd
telling whether to open the file or not. Then you call kfmclient
from kdeprintd module. This looks safer than relying on "sleep".

Michael.


More information about the Kde-print-devel mailing list