[Libreoffice-commits] core.git: vcl/inc vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sun Dec 29 14:13:26 UTC 2019
vcl/inc/pdf/XmpMetadata.hxx | 1 +
vcl/source/gdi/pdfwriter_impl.cxx | 5 ++++-
vcl/source/gdi/pdfwriter_impl.hxx | 4 ++++
vcl/source/pdf/XmpMetadata.cxx | 16 ++++++++++++++++
4 files changed, 25 insertions(+), 1 deletion(-)
New commits:
commit 06cbfe71c77cfd61b747b7f80dee37e59cff0118
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Dec 19 21:09:24 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Dec 29 15:12:49 2019 +0100
pdf: support for PDF/UA in PDFWriter, write flag to the metadata
This adds support for PDF/UA to the PDFWriter in form of a bool
flag and writes into the XmpMetadata that the document is supposed
to be PDF/UA compliant (even if it may not be).
Change-Id: If187152d3860397fc629e272c5b3888fca34e790
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85909
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/inc/pdf/XmpMetadata.hxx b/vcl/inc/pdf/XmpMetadata.hxx
index d9f9cacc45b4..cc3f8da1a34c 100644
--- a/vcl/inc/pdf/XmpMetadata.hxx
+++ b/vcl/inc/pdf/XmpMetadata.hxx
@@ -31,6 +31,7 @@ public:
OString msProducer;
OString msKeywords;
sal_Int32 mnPDF_A;
+ bool mbPDF_UA;
public:
XmpMetadata();
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 891d5db93a7b..e55efc180bb3 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1307,6 +1307,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
m_nAccessPermissions(0),
m_bIsPDF_A1( false ),
m_bIsPDF_A2( false ),
+ m_bIsPDF_UA( false ),
m_rOuterFace( i_rOuterFace )
{
m_aStructure.emplace_back( );
@@ -5225,7 +5226,7 @@ static void escapeStringXML( const OUString& rStr, OUString &rValue)
// emits the document metadata
sal_Int32 PDFWriterImpl::emitDocumentMetadata()
{
- if( !m_bIsPDF_A1 && !m_bIsPDF_A2 )
+ if (!m_bIsPDF_A1 && !m_bIsPDF_A2 && !m_bIsPDF_UA)
return 0;
//get the object number for all the destinations
@@ -5240,6 +5241,8 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
else if (m_bIsPDF_A2)
aMetadata.mnPDF_A = 2;
+ aMetadata.mbPDF_UA = m_bIsPDF_UA;
+
if (!m_aContext.DocumentInfo.Title.isEmpty())
{
OUString aTempString;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 6316b7daa92d..6c1dd623951e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -982,6 +982,10 @@ i12626
bool m_bIsPDF_A1;
/* true if PDF/A-2a is output */
bool m_bIsPDF_A2;
+
+ /* PDF/UA support enabled */
+ bool m_bIsPDF_UA;
+
PDFWriter& m_rOuterFace;
/*
diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index d9033f4875ae..281183c205e8 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -26,6 +26,7 @@ constexpr const char* constPadding = " "
XmpMetadata::XmpMetadata()
: mbWritten(false)
, mnPDF_A(0)
+ , mbPDF_UA(false)
{
}
@@ -107,6 +108,21 @@ void XmpMetadata::write()
aXmlWriter.endElement();
}
+ // PDF/UA
+ if (mbPDF_UA)
+ {
+ OString sPdfUaVersion = OString::number(1);
+ aXmlWriter.startElement("rdf:Description");
+ aXmlWriter.attribute("rdf:about", OString(""));
+ aXmlWriter.attribute("xmlns:pdfuaid", OString("http://www.aiim.org/pdfua/ns/id/"));
+
+ aXmlWriter.startElement("pdfuaid:part");
+ aXmlWriter.content(sPdfUaVersion);
+ aXmlWriter.endElement();
+
+ aXmlWriter.endElement();
+ }
+
// PDF properties
if (!msProducer.isEmpty() || !msKeywords.isEmpty())
{
More information about the Libreoffice-commits
mailing list