diff --git a/pdf.c b/pdf.c
index 895f7d03e00a848ddab9c968f2810cb7a5d620e1..5c2f49f72390fba44396923626c10b646d3d105e 100644
--- a/pdf.c
+++ b/pdf.c
@@ -603,7 +603,7 @@ init_parser(struct Env *aux)
 
 	/* body */
 	H_RULE(indobj,	CHX(stream, obj));
-	H_RULE(objdef,	SEQ(npair, KW("obj"), ws, indobj, KW("endobj")));
+	H_RULE(objdef,	SEQ(ws, npair, KW("obj"), ws, indobj, KW("endobj")));
 	H_RULE(body,	h_many(objdef));
 
 	/* for object streams */
@@ -623,7 +623,7 @@ init_parser(struct Env *aux)
 
 	/* cross-reference streams */
 	H_RULE(xstream,	h_bind(stmbeg, kxstream, aux));
-	H_AVRULE(xrstm,	SEQ(npair, KW("obj"), ws, xstream));
+	H_AVRULE(xrstm,	SEQ(ws, npair, KW("obj"), ws, xstream));
 		// XXX skip however much we consumed and check for "endstream endobj"?
 
 	/* trailer */