[Interest] How to Preset PDF output for QPrintDialog

Petric Frank pfrank at gmx.de
Tue Mar 17 21:22:23 CET 2026


Hello,

i have the following code snippet:
------------------- cut ----------------
   QPrinter printer;;

   printer.setPrinterName (QString ());
   printer.setOutputFormat (QPrinter::PdfFormat);
   printer.setOutputFileName ("xxx.pdf");

   QPrintDialog dialog (&printer, this);

   dialog.exec ();
------------------- cut ----------------

But in the dialog a real printer is preselected. The file name is 
correctly set.

I can manually select print to PDF and write it to the file. But this is 
not the intention. I want to have PDF output preselected.

Qt ist 10.0.2 on linux (x64) installed with online installer.

What am i missing ?

regards



More information about the Interest mailing list