From 39ab530db308d3a06397941327ce3e06e6dd3143 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 5 Jan 2025 13:21:19 -0500 Subject: [PATCH] Fix single pdf plot Fixes https://gitlab.com/kicad/code/kicad/-/issues/19501 --- pcbnew/pcb_plotter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pcbnew/pcb_plotter.cpp b/pcbnew/pcb_plotter.cpp index 63d38d8bba..53f8845c10 100644 --- a/pcbnew/pcb_plotter.cpp +++ b/pcbnew/pcb_plotter.cpp @@ -109,8 +109,9 @@ bool PCB_PLOTTER::Plot( const wxString& aOutputPath, const LSEQ& aLayersToPlot, jobfile_writer->AddGbrFile( layer, fullname ); } - if( m_plotOpts.GetFormat() != PLOT_FORMAT::PDF || !m_plotOpts.m_PDFSingle - || ( i == 0 && m_plotOpts.GetFormat() == PLOT_FORMAT::PDF + if( m_plotOpts.GetFormat() != PLOT_FORMAT::PDF + || !m_plotOpts.m_PDFSingle + || ( pageNum == 1 && m_plotOpts.GetFormat() == PLOT_FORMAT::PDF && m_plotOpts.m_PDFSingle ) ) { // this will only be used by pdf @@ -171,8 +172,10 @@ bool PCB_PLOTTER::Plot( const wxString& aOutputPath, const LSEQ& aLayersToPlot, // last page - if( m_plotOpts.GetFormat() != PLOT_FORMAT::PDF || !m_plotOpts.m_PDFSingle - || i == aLayersToPlot.size() - 1 ) + if( m_plotOpts.GetFormat() != PLOT_FORMAT::PDF + || !m_plotOpts.m_PDFSingle + || i == aLayersToPlot.size() - 1 + || pageNum == finalPageCount ) { plotter->EndPlot(); delete plotter->RenderSettings();