Skip to content

Commit

Permalink
Fix for when type isn't present in pages dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob1080 committed Feb 3, 2014
1 parent d9bbc10 commit 101d917
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PyPDF2/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,11 @@ def _flatten(self, pages=None, inherit=None, indirectRef=None):
self.flattenedPages = []
catalog = self.trailer["/Root"].getObject()
pages = catalog["/Pages"].getObject()
t = pages["/Type"]

t = "/Pages"
if "/Type" in pages:
t = pages["/Type"]

if t == "/Pages":
for attr in inheritablePageAttributes:
if attr in pages:
Expand Down

0 comments on commit 101d917

Please sign in to comment.