how to print a postscript file from own application ?
Michael Goffioul
goffioul at imec.be
Tue Oct 21 10:36:54 CEST 2003
Holger Schroeder wrote:
> Hi list,
>
> i am writing an own program that uses kde functionality. now i want to be able
> to print from that application.
>
> as far as i understood the documentation in kprinter.h, i am only able to use
> a qpainter and draw stuff on a page with it, which is then sent to the
> printer.
>
> but i am creating postscript output my myself by taking a "postscript
> template" and filling in the contents like date, name of the client and so
> on... is there any way to feed this postscript output into the kde printing
> system ?
KPrinter::printFiles()
But there's a tricky part here. KPrinter::preparePrinting() needs
to be called before, and this method is protected (it is called
automatically when using a QPainter). So the best current solution
is to subclass KPrinter and provide acces to the protected method,
then call it in your app. Something like:
class MyPrinter : public KPrinter
{
public:
void doPreparePrinting() { preparePrinting(); }
}
And in your code:
MyPrinter printer;
if (printer.setup())
{
printer.doPreparePrinting();
// create PS file
printer.printFiles(myPsFiles);
}
Michael.
--
------------------------------------------------------------------
Michael Goffioul IMEC-DESICS-MIRA
e-mail: goffioul at imec.be (Mixed-Signal and RF Applications)
Tel: +32/16/28-8510 Kapeldreef, 75
Fax: +32/16/28-1515 3001 HEVERLEE, BELGIUM
------------------------------------------------------------------
More information about the kde-print
mailing list