summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-12-17 23:48:52 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-12-27 01:39:26 +0100
commit2b68e8bc0303432625a87d6dd60d5e6c3de9be72 (patch)
treecb33173db98b2addda419d608fce5e54fb4fd059 /vcl/source
parentd93dde7f12493a4c4b9426943f2c54608725f0b7 (diff)
pdf: write correct conformance XPM metadata for PDF/A-4
Also write pdfaid:rev when we write metadata for PDF/A-4 (revision 2020). Change-Id: Idb1864ca2b66aa43e8c2f118e945d5fb37932935 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178676 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178780 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx9
-rw-r--r--vcl/source/pdf/XmpMetadata.cxx22
2 files changed, 22 insertions, 9 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7a521e27dbf6..e43dbe1b1cac 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5880,6 +5880,15 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
lcl_assignMeta(m_aContext.DocumentInfo.Subject, aMetadata.msSubject);
lcl_assignMeta(m_aContext.DocumentInfo.Producer, aMetadata.msProducer);
aMetadata.msPDFVersion = getPDFVersionStr(m_aContext.Version);
+ if (m_nPDFA_Version == 4)
+ {
+ // if we have embedded files we need to use conformance level "F"
+ aMetadata.msConformance = m_aEmbeddedFiles.empty() ? ""_ostr : "F"_ostr;
+ }
+ else
+ {
+ aMetadata.msConformance = "B"_ostr;
+ }
lcl_assignMeta(m_aContext.DocumentInfo.Keywords, aMetadata.msKeywords);
lcl_assignMeta(m_aContext.DocumentInfo.Contributor, aMetadata.maContributor);
lcl_assignMeta(m_aContext.DocumentInfo.Coverage, aMetadata.msCoverage);
diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index 47d76f187d02..c7e6b17deb3d 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -27,12 +27,7 @@ constexpr const char* constPadding = " "
"\n";
}
-XmpMetadata::XmpMetadata()
- : mbWritten(false)
- , mnPDF_A(0)
- , mbPDF_UA(false)
-{
-}
+XmpMetadata::XmpMetadata() = default;
void XmpMetadata::write()
{
@@ -62,10 +57,19 @@ void XmpMetadata::write()
aXmlWriter.content(sPdfVersion);
aXmlWriter.endElement();
- aXmlWriter.startElement("pdfaid:conformance");
- aXmlWriter.content("B"_ostr);
- aXmlWriter.endElement();
+ if (mnPDF_A == 4)
+ {
+ aXmlWriter.startElement("pdfaid:rev");
+ aXmlWriter.content("2020"_ostr);
+ aXmlWriter.endElement();
+ }
+ if (!msConformance.isEmpty())
+ {
+ aXmlWriter.startElement("pdfaid:conformance");
+ aXmlWriter.content(msConformance);
+ aXmlWriter.endElement();
+ }
aXmlWriter.endElement();
}