diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/pdf/COSWriter.hxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 19 |
2 files changed, 23 insertions, 4 deletions
diff --git a/vcl/inc/pdf/COSWriter.hxx b/vcl/inc/pdf/COSWriter.hxx index 2cc3790f76e0..b80f0f84f424 100644 --- a/vcl/inc/pdf/COSWriter.hxx +++ b/vcl/inc/pdf/COSWriter.hxx @@ -120,6 +120,14 @@ public: void writeLiteralEncrypt(std::u16string_view value, sal_Int32 nObject, rtl_TextEncoding nEncoding = RTL_TEXTENCODING_ASCII_US); + void writeKeyAndLiteralEncrypt(std::string_view key, std::u16string_view value, + sal_Int32 nObject, + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_ASCII_US) + { + mrBuffer.append(key); + writeLiteralEncrypt(value, nObject, nEncoding); + } + void writeLiteralEncrypt(std::string_view value, sal_Int32 nObject); void writeKeyAndLiteralEncrypt(std::string_view key, std::string_view value, sal_Int32 nObject) 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<</Type/Action/S"); if( bIsUNCPath ) // handle Win UNC paths { - aLine.append( "/Launch/Win<</F" ); - // INetURLObject is not good with UNC paths, use original path - aWriter.writeLiteralEncrypt(url, rLink.m_nObject, osl_getThreadTextEncoding()); - aLine.append( ">>" ); + 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 { |