shithub: neatpost

Download patch

ref: 90d1d12615657eb7c70cf7ce0d109fac6b5245e0
parent: 10f935774e53b1b3a6b27e6961952b69d1325f22
author: Ali Gholami Rudi <ali@rudi.ir>
date: Mon Apr 16 12:53:03 EDT 2018

pdf: take device resolution into account when scaling PDF images

Reported and tested by Dirk-Wilhelm Peters <peters@schwertfisch.de>.

--- a/pdf.c
+++ b/pdf.c
@@ -660,9 +660,9 @@
 		bbox = pdf_dval_val(pdf, len, pages, "/MediaBox");
 	if (bbox >= 0 && !pdfbbox(pdf, len, bbox, dim)) {
 		if (hwid > 0)
-			hzoom = hwid / (dim[2] - dim[0]);
+			hzoom = hwid / (dim[2] - dim[0]) * 7200 / dev_res;
 		if (vwid > 0)
-			vzoom = vwid / (dim[3] - dim[1]);
+			vzoom = vwid / (dim[3] - dim[1]) * 7200 / dev_res;
 		if (vwid <= 0)
 			vzoom = hzoom;
 		if (hwid <= 0)