vcl/source/gdi/pdfwriter_impl.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit f45401ce130f1377163e977f52b037b7b46b4910 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Dec 13 00:09:48 2024 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Dec 26 06:07:41 2024 +0100 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 <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178770 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> 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( "> ] " ); } - 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( " " ); } - 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)