path: root/src
diff options
authorJohn Layt <>2014-06-04 16:40:05 +0100
committerShawn Rutledge <>2015-04-17 05:22:36 +0000
commit92ea91836eedcf34e09df6b2bd3c34f0468acc49 (patch)
tree2cbddc8add5e72cca14c07e5352def553d8ec1b3 /src
parent6668f5becfb8fcb6d10e42495c6ea5cdba2d15c5 (diff)
QPrintDialog - Let OSX handle PDF printing
If the user selects to Save as PDF in the native print dialog, then let OSX generate the PDF. Primarily this is to fix QTBUG-38820 where by setting the output mode to PdfFormat we prevent the native print dialog from being called again. This was a regression in 5.1. It also allows for smaller, better quality PDFs with the ability to select text until QTBUG-13826 / QTBUG-10094 fixes the font rendering. Once QTBUG-36112 is also fixed we can consider changing back to Qt's internal PDF support. See also QTBUG-36687 and QTBUG-26054 which are related. Task-number: QTBUG-38820 Change-Id: I74bd885902860ac70068ab25e95765c7f0ee911c Reviewed-by: Andy Shaw <> Reviewed-by: Shawn Rutledge <>
Diffstat (limited to 'src')
1 files changed, 8 insertions, 5 deletions
diff --git a/src/printsupport/dialogs/ b/src/printsupport/dialogs/
index bc28350f6b..aec1e3babb 100644
--- a/src/printsupport/dialogs/
+++ b/src/printsupport/dialogs/
@@ -121,19 +121,22 @@ QT_USE_NAMESPACE
if (dialog->maxPage() < dialog->toPage())
dialog->setFromTo(dialog->fromPage(), dialog->maxPage());
- // Keep us in sync with file output
- PMDestinationType dest;
- // If the user selected print to file, the session has been
- // changed behind our back and our d->ep->session object is a
- // dangling pointer. Update it based on the "current" session
+ // Keep us in sync with chosen destination
+ PMDestinationType dest;
PMSessionGetDestinationType(session, settings, &dest);
if (dest == kPMDestinationFile) {
+ // QTBUG-38820
+ // If user selected Print to File, leave OSX to generate the PDF,
+ // otherwise setting PdfFormat would prevent us showing dialog again.
+ // TODO Restore this when QTBUG-36112 is fixed.
+ /*
QCFType<CFURLRef> file;
PMSessionCopyDestinationLocation(session, settings, &file);
UInt8 localFile[2048]; // Assuming there's a POSIX file system here.
CFURLGetFileSystemRepresentation(file, true, localFile, sizeof(localFile));
printer->setOutputFileName(QString::fromUtf8(reinterpret_cast<const char *>(localFile)));
+ */
} else {
PMPrinter macPrinter;
PMSessionGetCurrentPrinter(session, &macPrinter);