From 7acf971b55aeaedcf753fcb6cefb199fabc52ef0 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 23 Sep 2022 12:48:10 -0300 Subject: [PATCH] [PCB_Print] Changed scale strategy to make it more similar to old - Rounding the scale --- kibot/create_pdf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kibot/create_pdf.py b/kibot/create_pdf.py index be668202..e66cbc62 100644 --- a/kibot/create_pdf.py +++ b/kibot/create_pdf.py @@ -22,9 +22,10 @@ def create_pdf_from_pages(input_files, output_fn, forced_width=None): page_obj = pdf_reader.getPage(0) if forced_width is not None: width = float(page_obj.mediaBox.getWidth())*25.4/72 - scale = forced_width/width + scale = round(forced_width/width, 4) logger.debugl(1, 'PDF scale {} ({} -> {})'.format(scale, width, forced_width)) - page_obj.scaleBy(scale) + if abs(1.0-scale) > 0.0001: + page_obj.scaleBy(scale) page_obj.compressContentStreams() output.addPage(page_obj) # Write all pages to a file