vcl/source/pdf/XmpMetadata.cxx |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

New commits:
commit 72163db77aa1c160a63e64d5637de4a383966c76
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Oct 18 14:23:48 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Oct 18 22:26:36 2023 +0200

    tdf#157517 vcl: PDF/UA export: add PDF/A extension schema to XMP
    
    ... if PDF/A is also enabled.  Thanks to Peter Wyatt for the example
    document.
    
    Change-Id: I2a5951e102ae28a4c998adafe8ab51caa2788e4b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158118
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit a4971aab4d57bf9177c55c3fb0e163e0db7c48fd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158046
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index d4c58c23348b..bbe337de4146 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -107,8 +107,89 @@ void XmpMetadata::write()
         }
 
         // PDF/UA
-        if (mbPDF_UA && mnPDF_A == 0) // veraPDF says this is not allowed in 
PDF/A-[123][ab]
+        if (mbPDF_UA)
         {
+            if (mnPDF_A != 0)
+            { // tdf#157517 PDF/A extension schema is required
+                aXmlWriter.startElement("rdf:Description");
+                aXmlWriter.attribute("rdf:about", OString(""));
+                aXmlWriter.attribute("xmlns:pdfaExtension",
+                                     
OString("http://www.aiim.org/pdfa/ns/extension/";));
+                aXmlWriter.attribute("xmlns:pdfaSchema",
+                                     
OString("http://www.aiim.org/pdfa/ns/schema#";));
+                aXmlWriter.attribute("xmlns:pdfaProperty",
+                                     
OString("http://www.aiim.org/pdfa/ns/property#";));
+                aXmlWriter.startElement("pdfaExtension:schemas");
+                aXmlWriter.startElement("rdf:Bag");
+                aXmlWriter.startElement("rdf:li");
+                aXmlWriter.attribute("rdf:parseType", OString("Resource"));
+                aXmlWriter.startElement("pdfaSchema:namespaceURI");
+                aXmlWriter.content("http://www.aiim.org/pdfua/ns/id/";);
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaSchema:prefix");
+                aXmlWriter.content("pdfuaid");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaSchema:schema");
+                aXmlWriter.content("PDF/UA identification schema");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaSchema:property");
+                aXmlWriter.startElement("rdf:Seq");
+
+                aXmlWriter.startElement("rdf:li");
+                aXmlWriter.attribute("rdf:parseType", OString("Resource"));
+                aXmlWriter.startElement("pdfaProperty:category");
+                aXmlWriter.content("internal");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:description");
+                aXmlWriter.content("PDF/UA version identifier");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:name");
+                aXmlWriter.content("part");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:valueType");
+                aXmlWriter.content("Integer");
+                aXmlWriter.endElement();
+                aXmlWriter.endElement(); // rdf:li
+
+                aXmlWriter.startElement("rdf:li");
+                aXmlWriter.attribute("rdf:parseType", OString("Resource"));
+                aXmlWriter.startElement("pdfaProperty:category");
+                aXmlWriter.content("internal");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:description");
+                aXmlWriter.content("PDF/UA amendment identifier");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:name");
+                aXmlWriter.content("amd");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:valueType");
+                aXmlWriter.content("Text");
+                aXmlWriter.endElement();
+                aXmlWriter.endElement(); // rdf:li
+
+                aXmlWriter.startElement("rdf:li");
+                aXmlWriter.attribute("rdf:parseType", OString("Resource"));
+                aXmlWriter.startElement("pdfaProperty:category");
+                aXmlWriter.content("internal");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:description");
+                aXmlWriter.content("PDF/UA corrigenda identifier");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:name");
+                aXmlWriter.content("corr");
+                aXmlWriter.endElement();
+                aXmlWriter.startElement("pdfaProperty:valueType");
+                aXmlWriter.content("Text");
+                aXmlWriter.endElement();
+                aXmlWriter.endElement(); // rdf:li
+
+                aXmlWriter.endElement(); // rdf:Seq
+                aXmlWriter.endElement(); // pdfaSchema:property
+                aXmlWriter.endElement(); // rdf:li
+                aXmlWriter.endElement(); // rdf:Bag
+                aXmlWriter.endElement(); // pdfaExtension:schemas
+                aXmlWriter.endElement(); // rdf:Description
+            }
             OString sPdfUaVersion = OString::number(1);
             aXmlWriter.startElement("rdf:Description");
             aXmlWriter.attribute("rdf:about", OString(""));

Reply via email to