terhje
22nd February 2012, 10:18
Hi im writing a pdf report to a file from my program.
part of the code:
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(filename); //path + filename
QPainter painter;
painter.begin(&printer);
painter.drawText(sX,sY,"Adress:"); //sX,pX and sY are just coordinates in the pdf.
painter.drawText(pX,sY,adress);
painter.end();
my problem is that if the file already exists it wont write. i get error saying printer not active.
What i want to do is to just overwrite the old file.
any suggestions to how i can do this?
thx, Terhje
part of the code:
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(filename); //path + filename
QPainter painter;
painter.begin(&printer);
painter.drawText(sX,sY,"Adress:"); //sX,pX and sY are just coordinates in the pdf.
painter.drawText(pX,sY,adress);
painter.end();
my problem is that if the file already exists it wont write. i get error saying printer not active.
What i want to do is to just overwrite the old file.
any suggestions to how i can do this?
thx, Terhje