mirror of
https://github.com/kanzure/pdfparanoia.git
synced 2024-12-04 23:15:52 +01:00
getobj can raise PDFObjectNotFound
This commit is contained in:
parent
95a249d8ab
commit
e95374ec04
@ -10,6 +10,8 @@ from ..eraser import (
|
||||
)
|
||||
from ..plugin import Plugin
|
||||
|
||||
from pdfminer.pdftypes import PDFObjectNotFound
|
||||
|
||||
class JSTOR(Plugin):
|
||||
"""
|
||||
JSTOR
|
||||
@ -50,6 +52,7 @@ class JSTOR(Plugin):
|
||||
# check each object in the pdf
|
||||
for objid in objids:
|
||||
# get an object by id
|
||||
try:
|
||||
obj = pdf.getobj(objid)
|
||||
|
||||
if hasattr(obj, "attrs"):
|
||||
@ -92,6 +95,8 @@ class JSTOR(Plugin):
|
||||
replacements.append([objid, better_content])
|
||||
|
||||
page_id += 1
|
||||
except PDFObjectNotFound, e:
|
||||
print >>sys.stderr, 'Missing object: %r' % e
|
||||
|
||||
if verbose >= 1 and replacements:
|
||||
sys.stderr.write("%s: Found objects %s with %r; omitting..." % (cls.__name__, [deets[0] for deets in replacements], cls.requirements))
|
||||
|
Loading…
Reference in New Issue
Block a user