From 92ea91836eedcf34e09df6b2bd3c34f0468acc49 Mon Sep 17 00:00:00 2001 From: John Layt Date: Wed, 4 Jun 2014 16:40:05 +0100 Subject: 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 --- src/printsupport/dialogs/qprintdialog_mac.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/printsupport') diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index bc28350f6b..aec1e3babb 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -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 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(localFile))); + */ } else { PMPrinter macPrinter; PMSessionGetCurrentPrinter(session, &macPrinter); -- cgit v1.2.3