vcl/source/gdi/pdfwriter_impl.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
New commits: commit 19bcc67e3dc1b046f3e76d46966ef24240ab40d9 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Jan 22 14:58:13 2025 +0900 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Feb 5 13:14:31 2025 +0100 tdf#160196 add /AF entry to catalog, enable assoc. files in PDF/A-3 PDF 2.0 introduced "associated files" entry. Add the association for the attached files to the /Catalog (/AF entry) and make sure the /AFRelationship is set to /Source. Also enable this for PDF/A-3 (where this was apparently added), as this is required. Change-Id: I5d0048daeb6e78534cef8ceb467f6dd2627a53ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180566 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180875 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6dffb86b6c19..851663a9e101 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5156,6 +5156,13 @@ bool PDFWriterImpl::emitCatalog() aWriter.startObject(rAttachedFile.mnObjectId); aWriter.startDict(); aWriter.write("/Type", "/Filespec"); + + // Add associated files relationship (since PDF 2.0) + if (m_aContext.Version >= PDFWriter::PDFVersion::PDF_2_0 || m_nPDFA_Version == 3) + { + aWriter.write("/AFRelationship", "/Source"); + } + aWriter.writeKeyAndUnicodeEncrypt("/F", rAttachedFile.maFilename, rAttachedFile.mnObjectId); if (PDFWriter::PDFVersion::PDF_1_7 <= m_aContext.Version) { @@ -5195,6 +5202,16 @@ bool PDFWriterImpl::emitCatalog() if (!m_aDocumentAttachedFiles.empty()) { + // Write the associated files catalog entry (since PDF 2.0) + if (m_aContext.Version >= PDFWriter::PDFVersion::PDF_2_0 || m_nPDFA_Version == 3) + { + aLine.append("/AF"); + aLine.append("["); + for (auto & rAttachedFile : m_aDocumentAttachedFiles) + aWriter.writeReference(rAttachedFile.mnObjectId); + aLine.append("]"); + } + aWriter.startDictWithKey("/Names"); aWriter.startDictWithKey("/EmbeddedFiles"); aLine.append("/Names [");