diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 7016b470d61..e2e0877112c 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1742,6 +1742,8 @@ void QPdfEnginePrivate::writeInfo(const QDateTime &date) printString(title); write("\n/Creator "); printString(creator); + write("\n/Author "); + printString(author); write("\n/Producer "); printString(QString::fromLatin1("Qt " QT_VERSION_STR)); @@ -1847,6 +1849,13 @@ int QPdfEnginePrivate::writeXmpDocumentMetaData(const QDateTime &date) w.writeEndElement(); w.writeEndElement(); w.writeEndElement(); + w.writeStartElement(dcNS, "creator"); + w.writeStartElement(rdfNS, "Seq"); + w.writeStartElement(rdfNS, "li"); + w.writeCharacters(author); + w.writeEndElement(); + w.writeEndElement(); + w.writeEndElement(); w.writeEndElement(); // PDF diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index c731c043e7f..4b301db71a7 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -265,6 +265,7 @@ public: QString outputFileName; QString title; QString creator; + QString author; QUuid documentId = QUuid::createUuid(); bool embedFonts; int resolution; diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index be4b73aa640..c08931658ca 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -211,6 +211,26 @@ void QPdfWriter::setDocumentId(const QUuid &documentId) d->engine->d_func()->documentId = documentId; } +/*! + \since 6.9 + Returns the author of the document. + */ +QString QPdfWriter::author() const +{ + Q_D(const QPdfWriter); + return d->engine->d_func()->author; +} + +/*! + \since 6.9 + Sets the author of the document to \a author. + */ +void QPdfWriter::setAuthor(const QString &author) +{ + Q_D(QPdfWriter); + d->engine->d_func()->author = author; +} + /*! \reimp */ diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 2938f5c1cf0..f9577ce7050 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -39,6 +39,9 @@ public: QUuid documentId() const; void setDocumentId(const QUuid &documentId); + QString author() const; + void setAuthor(const QString &author); + bool newPage() override; void setResolution(int resolution);