vcl/source/gdi/pdfwriter_impl.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit c5ba0826be79004570659b204dc780948a5b7822 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Apr 4 12:25:44 2023 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Apr 6 11:33:53 2023 +0200 vcl: PDF export: fix erroneous MCID produced for 1st page PDFWriterImpl::beginStructureElementMCSeq() emits a spurious MCID definition outside of any stream, before the 1st page: /Document<</MCID 1>>BDC % PDFPage::emit 1 0 obj <</Type/Page/Parent... This is because SwPageFrame is translated to a Document StructElem in EnhancedPDFExportHelper, but PDFPage::emit is called at a later time than when the page content stream is produced, so this is just wrong; an MCID inside the page content stream is pointless because that's an object already anyway, so just suppress this. Looks like other applications don't produce Document currently. Change-Id: Ic2e30e4125c0e97c8e47330c7a247f74efc18f98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150017 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 22fd7ccb913c55db14adf736859fc9e0e7f00630) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149980 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 3ce03d88f734..39f832384e1a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10610,6 +10610,9 @@ void PDFWriterImpl::beginStructureElementMCSeq() { if( m_bEmitStructure && m_nCurrentStructElement > 0 && // StructTreeRoot + // Document = SwPageFrame => this is not *inside* the page content + // stream so do not emit MCID! + m_aStructure[m_nCurrentStructElement].m_eType != PDFWriter::Document && ! m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq // already opened sequence ) {