diff options
author | Tobias Koenig <tobias.koenig@kdab.com> | 2017-09-14 10:14:48 +0200 |
---|---|---|
committer | Tobias Koenig <tobias.koenig@kdab.com> | 2017-09-14 11:56:54 +0000 |
commit | 62ea3eaf05cf591155028e1e3c5684b25060184c (patch) | |
tree | cb4a1675eb0cd0f10a1f6ebc02e1758e6f22bd64 /src/gui | |
parent | 306a6b9dec705742184badc802ce4b63d869b12f (diff) |
Improve PDF/A-1b support in QPdfWriter
Fix warning of missing F key in Annot directory. The F key needs
to have the printing flag (bit 3) enabled and all other bits disabled.
(Clause 6.5.3 in ISO 19005-1:2005)
Change-Id: Iddba6b71f516aca75cd573584aa184c1b808863d
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpdf.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 2b892159c5..e421055ef3 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1063,7 +1063,12 @@ void QPdfEngine::drawHyperlink(const QRectF &r, const QUrl &url) char buf[256]; const QRectF rr = d->pageMatrix().mapRect(r); - d->xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); + d->xprintf("<<\n/Type /Annot\n/Subtype /Link\n"); + + if (d->pdfVersion == QPdfEngine::Version_A1b) + d->xprintf("/F 4\n"); // enable print flag, disable all other + + d->xprintf("/Rect ["); d->xprintf("%s ", qt_real_to_string(rr.left(), buf)); d->xprintf("%s ", qt_real_to_string(rr.top(), buf)); d->xprintf("%s ", qt_real_to_string(rr.right(), buf)); @@ -2831,7 +2836,12 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) x2s.setNum(static_cast<double>(x2), 'f'); y2s.setNum(static_cast<double>(y2), 'f'); QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s; - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); + xprintf("<<\n/Type /Annot\n/Subtype /Link\n"); + + if (pdfVersion == QPdfEngine::Version_A1b) + xprintf("/F 4\n"); // enable print flag, disable all other + + xprintf("/Rect ["); xprintf(rectData.constData()); #ifdef Q_DEBUG_PDF_LINKS xprintf("]\n/Border [16 16 1]\n/A <<\n"); |