#include#include QPrinter printer(QPrinter::PrinterResolution); QPrintDialog *dialog = new QPrintDialog(&printer); if ( dialog->exec() == QDialog::Accepted) { printer.setOutputFormat(QPrinter::PdfFormat); // print the document }
#includeIn this example, we create an instance of the QPrinter class and set the output format to PostScript using the setOutputFormat function. Package library: QtQPrinter printer(QPrinter::PrinterResolution); printer.setOutputFormat(QPrinter::PostScriptFormat);