Skip to content

Commit e541dc6

Browse files
committed
libcupsfilters: In pdftopdf() add 2% tolerance for input size larger output page
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.
1 parent 70970df commit e541dc6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cupsfilters/pdftopdf/pdftopdf_processor.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters &param,pdftop
228228
for (int i = 0; i < (int)input_page_range_list.size(); i ++)
229229
{
230230
PageRect r = input_page_range_list[i]->getRect();
231-
int w = r.width;
232-
int h = r.height;
231+
int w = r.width * 100 / 102; // 2% of tolerance
232+
int h = r.height * 100 / 102;
233233
if ((w > param.page.width || h > param.page.height) &&
234234
(h > param.page.width || w > param.page.height))
235235
{

0 commit comments

Comments
 (0)