Commit 9368a860 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix a bug in PDFDocument.getContentInformation.

that raises an Exception for PDF documents without any metadata.
parent 4bb64d8b
......@@ -277,7 +277,7 @@ class PDFDocument(Image):
else:
try:
pdf_file = PdfFileReader(tmp)
for info_key, info_value in pdf_file.getDocumentInfo().iteritems():
for info_key, info_value in (pdf_file.getDocumentInfo() or {}).iteritems():
info_key = info_key.lstrip("/")
if isinstance(info_value, unicode):
info_value = info_value.encode("utf-8")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment