]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: In pdftopdf() add 2% tolerance for input size larger output page
authorTill Kamppeter <till.kamppeter@gmail.com>
Sat, 5 Feb 2022 18:34:21 +0000 (15:34 -0300)
committerTill Kamppeter <till.kamppeter@gmail.com>
Sat, 5 Feb 2022 18:34:21 +0000 (15:34 -0300)
When "print-scaling=auto" or "print-scaling=auto-fit" is used, the
input pages are scaled when they do not fit into the output page
size. Often input ad out page sizes are supposed to be equal, for
example both A4, but rounding errors could make the input considered
larger and unnecessarily scaled.

Therefore we add 2% of tolerance before considering an input page too
large.

cupsfilters/pdftopdf/pdftopdf_processor.cc

index 83f84777d536976deb3dd32e4d0be4e7364b658d..0be531387fe4a0a9f9579da56222177c1d9e3348 100644 (file)
@@ -228,8 +228,8 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters &param,pdftop
     for (int i = 0; i < (int)input_page_range_list.size(); i ++)
     {
       PageRect r = input_page_range_list[i]->getRect();
-      int w = r.width;
-      int h = r.height;
+      int w = r.width * 100 / 102; // 2% of tolerance
+      int h = r.height * 100 / 102;
       if ((w > param.page.width || h > param.page.height) &&
          (h > param.page.width || w > param.page.height))
       {