summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-12-13 00:09:48 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-12-26 06:07:41 +0100
commitf45401ce130f1377163e977f52b037b7b46b4910 (patch)
treedbf09c9c921af6c78f137b795f1f5539a0104f73 /vcl/source
parent1846448d81aab9812410a30303c0c36a41a825b6 (diff)
pdf: Don't write non-standard LO keys when using PDF/A or PDF/UA
We write /DocChecksum and /AdditionalStreams entries into the trailer dictionary, which is not allowed by the standard in any case. To avoid a potential compliance checker to report errors because of this, the writing is shorted out if PDF/A or PDF/UA are enabled. Change-Id: I98247e89f1984f158ffbcb78b9e3713fcab053fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178414 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178770 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index ec3d5ca549b0..faf795fa60c7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6232,14 +6232,21 @@ bool PDFWriterImpl::emitTrailer()
aLine.append( "> ]\n" );
}
- if( !aDocChecksum.isEmpty() )
+ // Writes the /DocChecksum - hash off the PDF stream
+ // This entry is not defined in the standard, so don't write it if we
+ // are using PDF/UA or PDF/A as the compliance checkers will complain.
+ // Actually we shouldn't write it at all...
+ if (!aDocChecksum.isEmpty() && !m_bIsPDF_UA && m_nPDFA_Version == 0)
{
aLine.append( "/DocChecksum /" );
aLine.append( aDocChecksum );
aLine.append( "\n" );
}
- if (!m_aDocumentAttachedFiles.empty())
+ // Writes the /AdditionalStreams - writes the embedded / attached files into the PDF
+ // This entry is not defined in the standard, so don't write it if we
+ // are using PDF/UA or PDF/A as the compliance checkers will complain.
+ if (!m_aDocumentAttachedFiles.empty() && !m_bIsPDF_UA && m_nPDFA_Version == 0)
{
aLine.append( "/AdditionalStreams [" );
for (auto const& rAttachedFile : m_aDocumentAttachedFiles)