summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2018-09-06 17:16:44 +0200
committerAndre de la Rocha <andre.rocha@qt.io>2018-10-22 15:53:17 +0000
commit1bb8627f8f1dea546f766a37888fe331381fa333 (patch)
tree966542ed538ae8807405dfeeed0f7da44df8425c /src/printsupport
parenta87f85dbf9bd1ea90936bd9a4609229edb15c264 (diff)
Extend PDF engine to allow the generation of PDFs with huge pages
Qt's PDF engine previously supported only the PDF v1.4 standard, which only allows pages of up to 200x200in (about 5x5m). This patch optionally enables the generation of PDF v1.6-compliant files that allow the redefinition of user space units, so that pages of up to 381x381km are now possible. By default, generated files are compliant to v1.4 spec. v1.6 compliance must be enabled by, e.g., calling QPrinter::setPdfVersion() with QPrinter::PdfVersion_1_6. PDF v1.6-compliant files require Adobe Reader 7.0 or newer (also worked with the built-in viewers in current versions of Chrome, Firefox and Edge). Task-number: QTBUG-69386 Change-Id: I21708e0d465d5d7d9e46ff06dd04acfe1dfb0858 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/kernel/qprinter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index ed4292ff3d..829a13863b 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -149,7 +149,12 @@ void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterI
printEngine = ps->createNativePrintEngine(printerMode, printerName);
paintEngine = ps->createPaintEngine(printEngine, printerMode);
} else {
- const auto pdfEngineVersion = (pdfVersion == QPrinter::PdfVersion_1_4 ? QPdfEngine::Version_1_4 : QPdfEngine::Version_A1b);
+ static const QHash<QPrinter::PdfVersion, QPdfEngine::PdfVersion> engineMapping {
+ {QPrinter::PdfVersion_1_4, QPdfEngine::Version_1_4},
+ {QPrinter::PdfVersion_A1b, QPdfEngine::Version_A1b},
+ {QPrinter::PdfVersion_1_6, QPdfEngine::Version_1_6}
+ };
+ const auto pdfEngineVersion = engineMapping.value(pdfVersion, QPdfEngine::Version_1_4);
QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode, pdfEngineVersion);
paintEngine = pdfEngine;
printEngine = pdfEngine;