diff options
author | Jordi Pujol Foyo <jordi@vikingsoftware.com> | 2019-12-13 14:27:11 +0100 |
---|---|---|
committer | Jordi Pujol Foyo <jordi@vikingsoftware.com> | 2019-12-19 21:23:43 +0100 |
commit | 9d6b4d11424cdcd6c572cdcc50b3b790b6e673c0 (patch) | |
tree | b51c3f23188465627df655339166f5c1241a5d25 /src/gui/painting/qpdfwriter.cpp | |
parent | 6227a0d2e2e924cf717fa2a3d7c3e1223c4aed5f (diff) |
New features for QPdfWriter
Added new API setDocumentXmpMetadata/documentXmpMetadata and
addFileAttachment
[ChangeLog][QtGui][QPdfWriter] New API to provide external document XMP
metadata and attach files to PDF.
Fixes: QTBUG-78651
Fixes: QTBUG-78764
Change-Id: Ic0b37e8d12899f907001db469080594c14c87655
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/painting/qpdfwriter.cpp')
-rw-r--r-- | src/gui/painting/qpdfwriter.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 35814d146c..4f70fe6ad2 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -266,6 +266,50 @@ int QPdfWriter::resolution() const return d->engine->resolution(); } +/*! + \since 5.15 + + Sets the document metadata. This metadata is not influenced by the setTitle / setCreator methods, + so is up to the user to keep it consistent. + \a xmpMetadata contains XML formatted metadata to embed into the PDF file. + + \sa documentXmpMetadata() +*/ + +void QPdfWriter::setDocumentXmpMetadata(const QByteArray &xmpMetadata) +{ + Q_D(const QPdfWriter); + d->engine->setDocumentXmpMetadata(xmpMetadata); +} + +/*! + \since 5.15 + + Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata. It will not + return the default metadata. + + \sa setDocumentXmpMetadata() +*/ + +QByteArray QPdfWriter::documentXmpMetadata() const +{ + Q_D(const QPdfWriter); + return d->engine->documentXmpMetadata(); +} + +/*! + \since 5.15 + + Adds \a fileName attachment to the PDF with (optional) \a mimeType + \a data contains the raw file data to embed into the PDF file. +*/ + +void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType) +{ + Q_D(QPdfWriter); + d->engine->addFileAttachment(fileName, data, mimeType); +} + // Defined in QPagedPaintDevice but non-virtual, add QPdfWriter specific doc here #ifdef Q_QDOC /*! |