2008-10-27 18:21:20 |
Tim Arnold |
description |
Originally reported via e-mail from Robert Boulanger:
I'm using your PyPDF Library specially for cataloging pdf files. When reading the DocumentInfos (Metadata, it often happens, that pdf's have the same keys multiple times.
In this case your lib raises an error, since multible keys are not permitted.
Wouldn't it be better to just skip the additional key/value pairs instead of raising an error ?
I changed generic.py in line 492 as follows:
if data.has_key(key):
# multiple definitions of key not permitted
pass
#raise utils.PdfReadError, "multiple definitions in dictionary"
else:
data[key] = value |
Originally reported via e-mail from Robert Boulanger:
I'm using your PyPDF Library specially for cataloging pdf files. When reading the DocumentInfos (Metadata, it often happens, that pdf's have the same keys multiple times.
In this case your lib raises an error, since multible keys are not permitted.
Wouldn't it be better to just skip the additional key/value pairs instead of raising an error ?
I changed generic.py in line 492 as follows:
if data.has_key(key):
# multiple definitions of key not permitted
pass
#raise utils.PdfReadError, "multiple definitions in dictionary"
else:
data[key] = value
==============================
Just adding that I too had to make the same change. I create pdf files with pdflatex using hyperref. Some of my pdfs could not be opened by pyPdf, although some could be opened with no problem (all generated using the same workflow). In any case, this modification made it possible to open all of my pdfs.
I think it should be considered for adding to the real distribution.
thanks,
--Tim Arnold |
|