diff --git a/pdf.c b/pdf.c
index b3101781628c5c931c9a0750970592b9f7721710..a7697b557e16a68b17e9e2d35c808a22d0e509fa 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4367,7 +4367,7 @@ process_page_content(struct Env *aux)
 	/* find the last trailer dictionary */
 	if (aux->nxrefs == 0)
 		return;
-	tok = aux->xrefs[aux->nxrefs - 1];	/* last xref section */
+	tok = aux->xrefs[0];	/* first element is latest (reverse order) */
 	trailer = H_INDEX(Dict, tok, 1);
 
 	/* fetch Size (a required field) from the trailer dictionary */