From c54ee380a0759f1e5cde37b185a300c45063a1bc Mon Sep 17 00:00:00 2001 From: Oleg Parashchenko Date: Mon, 23 Jul 2012 15:43:02 +0200 Subject: [PATCH] Accept xref streams with the type field not present. --- pyPdf/pdf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyPdf/pdf.py b/pyPdf/pdf.py index bf60d01..2030a97 100644 --- a/pyPdf/pdf.py +++ b/pyPdf/pdf.py @@ -798,6 +798,11 @@ def read(self, stream): di = convertToInt(d, entrySizes[i]) if i == 0: xref_type = di + # PDF spec: If the first element is zero, the + # type field is not present, and it defaults + # to type 1. + if (0 == xref_type) and (0 == entrySizes[0]): + xref_type = 1 elif i == 1: if xref_type == 0: next_free_object = di