shithub: pdffs

Download patch

ref: 5434f5762ec22c52803a9db370cbed81d406d857
parent: dee52587b85a66c8309d36f2cb0c24c29775343a
author: Noam Preil <noam@pixelhero.dev>
date: Tue Sep 6 23:01:54 EDT 2022

render: cropbox is inheritable

--- a/op.c
+++ b/op.c
@@ -1358,10 +1358,18 @@
 Object*
 pagecropbox(Page *p)
 {
-	Object *o = dictget(p->obj, "CropBox");
-	if(o == &null)
+	Object *page = p;
+	Object *o;
+	while(page != &null){
+		o = dictget(p->obj, "CropBox");
+		if(o != &null)
+			return o;
 		o = dictget(p->obj, "MediaBox");
-	return o;
+		if(o != &null)
+			return o;
+		page = dictget(page, "Parent");
+	}
+	return &null;
 }
 
 void