summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-09-16 23:40:51 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-17 07:33:39 +0200
commit06e35b3289090ec623fe5284976ee6f40681e1d5 (patch)
tree5a936974ee7e432b1d5bd34d2d5f67ca241471da /vcl/source/gdi
parentbd066a17a22826ceb10e7763074704289f838f74 (diff)
tdf#136805 PDF export: re-add XMP basic meta data
VeraPDF complains about: <rule specification="ISO 19005-1:2005" clause="6.7.3" testNumber="1" status="failed" passedChecks="0" failedChecks="1"> <description>If a document information dictionary does appear at a document, then all of its entries that have analogous properties in predefined XMP schemas, shall also be embedded in the file in XMP form with equivalent values.</description> <object>CosDocument</object> <test>doesInfoMatchXMP</test> <check status="failed"> <context>root</context> </check> </rule> The regressing commit dropped the XMP Basic schema meta data (http://ns.adobe.com/xap/1.0/"). FWIW: xmp is the referred prefix, so we'll continue to use it. Regressed-by: d016e052ddf30649ad9b729b59134ce1e90a0263 Change-Id: I11b06fdafcb07732b92f0bd99b18afa3a9e498ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102888 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx47
1 files changed, 17 insertions, 30 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e955bb9b7842..b8c9614359c7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5223,6 +5223,16 @@ static void escapeStringXML( const OUString& rStr, OUString &rValue)
}
}
+static void lcl_assignMeta(const OUString& aValue, OString& aMeta)
+{
+ if (!aValue.isEmpty())
+ {
+ OUString aTempString;
+ escapeStringXML(aValue, aTempString);
+ aMeta = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
+ }
+}
+
// emits the document metadata
sal_Int32 PDFWriterImpl::emitDocumentMetadata()
{
@@ -5245,36 +5255,13 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadata.mbPDF_UA = m_bIsPDF_UA;
- if (!m_aContext.DocumentInfo.Title.isEmpty())
- {
- OUString aTempString;
- escapeStringXML(m_aContext.DocumentInfo.Title, aTempString);
- aMetadata.msTitle = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
- }
- if (!m_aContext.DocumentInfo.Author.isEmpty())
- {
- OUString aTempString;
- escapeStringXML(m_aContext.DocumentInfo.Author, aTempString);
- aMetadata.msAuthor = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
- }
- if (!m_aContext.DocumentInfo.Subject.isEmpty())
- {
- OUString aTempString;
- escapeStringXML(m_aContext.DocumentInfo.Subject, aTempString);
- aMetadata.msSubject = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
- }
- if (!m_aContext.DocumentInfo.Producer.isEmpty())
- {
- OUString aTempString;
- escapeStringXML(m_aContext.DocumentInfo.Producer, aTempString);
- aMetadata.msProducer = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
- }
- if (!m_aContext.DocumentInfo.Keywords.isEmpty())
- {
- OUString aTempString;
- escapeStringXML(m_aContext.DocumentInfo.Keywords, aTempString);
- aMetadata.msKeywords = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
- }
+ lcl_assignMeta(m_aContext.DocumentInfo.Title, aMetadata.msTitle);
+ lcl_assignMeta(m_aContext.DocumentInfo.Author, aMetadata.msAuthor);
+ lcl_assignMeta(m_aContext.DocumentInfo.Subject, aMetadata.msSubject);
+ lcl_assignMeta(m_aContext.DocumentInfo.Producer, aMetadata.msProducer);
+ lcl_assignMeta(m_aContext.DocumentInfo.Keywords, aMetadata.msKeywords);
+ lcl_assignMeta(m_aContext.DocumentInfo.Creator, aMetadata.m_sCreatorTool);
+ aMetadata.m_sCreateDate = m_aCreationMetaDateString;
OStringBuffer aMetadataObj( 1024 );