From 90d1d12615657eb7c70cf7ce0d109fac6b5245e0 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Mon, 16 Apr 2018 16:53:03 +0430 Subject: [PATCH] pdf: take device resolution into account when scaling PDF images Reported and tested by Dirk-Wilhelm Peters . --- pdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdf.c b/pdf.c index 0b66ba7..0c05390 100644 --- a/pdf.c +++ b/pdf.c @@ -660,9 +660,9 @@ static int pdfext(char *pdf, int len, int hwid, int vwid) 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)