From c55d2c092e76640c9f39ca63e5681d837b3e9b62 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 1 May 2025 19:57:15 +0200 Subject: [PATCH] PDF plotter: fix a rare pen width issue when plotting many pages in one file. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20805 (cherry picked from commit a02f1f2411768cba8640ae0e221b09d822849bc4) --- common/plotters/PDF_plotter.cpp | 4 ++++ pcbnew/plot_board_layers.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index a2b0ade1e6..43f6b46141 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -678,6 +678,10 @@ void PDF_PLOTTER::StartPage( const wxString& aPageNumber, const wxString& aPageN m_paperSize.x *= 10.0 / m_iuPerDeviceUnit; m_paperSize.y *= 10.0 / m_iuPerDeviceUnit; + // Set m_currentPenWidth to a unused value to ensure the pen width + // will be initialized to a the right value in pdf file by the first item to plot + m_currentPenWidth = 0; + // Open the content stream; the page object will go later m_pageStreamHandle = startPdfStream(); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 637938b085..74ff19aa0d 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -1364,6 +1364,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL return nullptr; } + void setupPlotterNewPDFPage( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS* aPlotOpts, const wxString& aLayerName, const wxString& aSheetName, const wxString& aSheetPath, const wxString& aPageNumber,