From fe40cf26a3b416e4d3a71d4164f94ea10b68631e Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 17 Dec 2024 22:39:59 +0900 Subject: pdf: /Win entry is deprecated in PDF 2.0 for launch actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /Win is deprecated, as well as /Mac and /Unix (which we don't write), so instead write /F directly, not under /Win entry. Change-Id: Ic6b71f6e7aba8d5e4a22e678f82fa5a70d9b7c5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178674 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178776 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins --- vcl/source/gdi/pdfwriter_impl.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 11badef65241..84e40b463fe9 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3678,10 +3678,21 @@ we check in the following sequence: aLine.append( "/A<>" ); + aLine.append("/Launch"); + // Entry /Win is deprecated in PDF 2.0 + if (m_aContext.Version >= PDFWriter::PDFVersion::PDF_2_0) + { + // So write /F directly. AFAICS it's up to PDF viewer to resolve this correctly + aWriter.writeKeyAndLiteralEncrypt("/F", url, rLink.m_nObject, osl_getThreadTextEncoding()); + } + else + { + aLine.append("/Win"); + aWriter.startDict(); + // INetURLObject is not good with UNC paths, use original path + aWriter.writeKeyAndLiteralEncrypt("/F", url, rLink.m_nObject, osl_getThreadTextEncoding()); + aWriter.endDict(); + } } else { -- cgit