vcl/source/gdi/pdfwriter_impl.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit e12a65c151db69f93b8d26202d17ee3a9ddae063 Author: Neil Fachin <neilfac...@gmail.com> AuthorDate: Tue Jul 22 20:08:45 2025 -0700 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Tue Jul 29 08:37:12 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 (cherry picked from commit 54b6ed66901d9dc25e8f1636aca08fb9f3d8b5c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188517 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 88722e9bcfd4..45b01e1aed3d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5367,7 +5367,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 ); @@ -5382,12 +5382,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[" );