vcl/source/gdi/pdfwriter_impl.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit 54b6ed66901d9dc25e8f1636aca08fb9f3d8b5c6 Author: Neil Fachin <neilfac...@gmail.com> AuthorDate: Tue Jul 22 20:08:45 2025 -0700 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jul 29 06:16:47 2025 +0200 tdf#155419 tdf#156477 PDF Export: emitCatalog fixes for OpenAction Modifies condition check in emitCatalog so that it does not add OpenAction when using default initial page and magnification settings for pdf export. Previous behavior always adds an OpenAction to pdfs on export which can cause them to be flagged as potentially malicious. Also changes behavior of FitWidth and FitVisible switch cases. Previously they were using hardcoded values for A4 documents, causing them to open to incorrect locations in pdf readers for other document sizes. Now uses "null" which preserves current vertical position. Change-Id: Id65841baf791be34be79647d2094dfb2c0bcdd60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188219 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4d5ffe83c18a..947b88945c3d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5368,7 +5368,7 @@ bool PDFWriterImpl::emitCatalog() { case PDFWriter::ActionDefault : //do nothing, this is the Acrobat default default: - if( aInitPageRef.getLength() > 1 ) + if ( aInitPageRef.getLength() > 1 && m_aContext.InitialPage > 0 ) { aLine.append( "/OpenAction[" ); aLine.append( aInitPageRef ); @@ -5383,12 +5383,12 @@ bool PDFWriterImpl::emitCatalog() case PDFWriter::FitWidth : aLine.append( "/OpenAction[" ); aLine.append( aInitPageRef ); - aLine.append( " /FitH 842] " ); //Open fit width, default A4 height in pt, OK to use hardcoded value here? + aLine.append( " /FitH null] " ); //Open fit width break; case PDFWriter::FitVisible : aLine.append( "/OpenAction[" ); aLine.append( aInitPageRef ); - aLine.append( " /FitBH 842] " ); //Open fit visible, , default A4 height in pt, OK to use hardcoded value here? + aLine.append( " /FitBH null] " ); //Open fit visible break; case PDFWriter::ActionZoom : aLine.append( "/OpenAction[" );