PDA

View Full Version : Generate PDF



lexfridman
5th July 2008, 21:56
There's a way to "paint" to an SVG file using QSvgGenerator class (link (http://doc.trolltech.com/4.4/qsvggenerator.html)). Is there a way to generate PDF files, or do I have to convert from SVG to PDF using an external program.

jpn
5th July 2008, 22:13
You can use QPrinter::PdfFormat:


QSvgRenderer renderer("filename.svg");

QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("filename.pdf");

QPainter painter(&printer);
renderer.render(&painter);
painter.end();

Fatla
5th July 2008, 22:35
You can use QPrinter to generate pdf :




QPrinter printer;
printer.setOutputFileName("My Report.pdf");
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);


P.S : Have a look at the attached file ; it's a small application that generates & print PDF .
Hope to be Helpful .

rmagro
31st August 2008, 12:44
I tried to use your application but it does not send a pdf file to printer. It only treats text file and not binary file..Am I right? Or am i missing something?

Thank you