PDF: add support for the Author field
[ChangeLog][QtGui][QPdfWriter] It is now possible to set the Author information for a PDF file. Change-Id: I27cb409d37cb79d9476a4da0c82d4a6d35f5fe8d Reviewed-by: Albert Astals Cid <aacid@kde.org>
This commit is contained in:
parent
3270232cca
commit
a0a0828566
@ -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
|
||||
|
@ -265,6 +265,7 @@ public:
|
||||
QString outputFileName;
|
||||
QString title;
|
||||
QString creator;
|
||||
QString author;
|
||||
QUuid documentId = QUuid::createUuid();
|
||||
bool embedFonts;
|
||||
int resolution;
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user