shithub: pdffs

Download patch

ref: 774b1921257a4f2093733e41c34fd5d9896b351a
parent: 8e5f56dadad7bcc32301470aa0b55972fc3abbb9
author: Noam Preil <noam@pixelhero.dev>
date: Thu Apr 7 20:17:14 EDT 2022

ctm: initialize with CropBox info, not MediaBox

--- a/op.c
+++ b/op.c
@@ -1214,14 +1214,13 @@
 void
 ctminit(Page *p, double *ctm)
 {
-	Object *mediabox;
+	Object *cropbox;
 	double mx, my;
 	matidentity(ctm);
-	/* TODO: check if it's legal for MediaBox to be absent */
-	if((mediabox = dictget(p->obj, "MediaBox")) == nil)
+	if((cropbox = dictget(p->obj, "CropBox")) == nil)
 		return;
-	mx = arrayget(mediabox, 2)->num.d;
-	my = arrayget(mediabox, 3)->num.d;
+	mx = arrayget(cropbox, 2)->num.d;
+	my = arrayget(cropbox, 3)->num.d;
 	ctm[0] = 850 / mx;
 	ctm[3] = 1100 / my;
 }