diff --git a/pdfparanoia/parser.py b/pdfparanoia/parser.py index 846008b..5fe2420 100644 --- a/pdfparanoia/parser.py +++ b/pdfparanoia/parser.py @@ -16,6 +16,7 @@ except ImportError: # py3k # from pdfquery import PDFQuery import pdfminer.pdfparser +import pdfminer.pdfdocument from .eraser import replace_object_with @@ -28,9 +29,7 @@ def parse_pdf(handler): # setup for parsing parser = pdfminer.pdfparser.PDFParser(handler) - doc = pdfminer.pdfparser.PDFDocument() - parser.set_document(doc) - doc.set_parser(parser) + doc = pdfminer.pdfdocument.PDFDocument(parser) # actual parsing doc.initialize() @@ -58,8 +57,7 @@ def deflate(content): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # store new replacements diff --git a/pdfparanoia/plugins/aip.py b/pdfparanoia/plugins/aip.py index 9e93e71..e824b38 100644 --- a/pdfparanoia/plugins/aip.py +++ b/pdfparanoia/plugins/aip.py @@ -25,8 +25,7 @@ class AmericanInstituteOfPhysics(Plugin): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # check each object in the pdf diff --git a/pdfparanoia/plugins/ieee.py b/pdfparanoia/plugins/ieee.py index 4acb9d6..f8c22bf 100644 --- a/pdfparanoia/plugins/ieee.py +++ b/pdfparanoia/plugins/ieee.py @@ -22,8 +22,7 @@ class IEEEXplore(Plugin): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # check each object in the pdf diff --git a/pdfparanoia/plugins/jstor.py b/pdfparanoia/plugins/jstor.py index 0ca971d..abb2d28 100644 --- a/pdfparanoia/plugins/jstor.py +++ b/pdfparanoia/plugins/jstor.py @@ -44,8 +44,7 @@ class JSTOR(Plugin): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # check each object in the pdf diff --git a/pdfparanoia/plugins/rsc.py b/pdfparanoia/plugins/rsc.py index 524fc32..3125ae5 100644 --- a/pdfparanoia/plugins/rsc.py +++ b/pdfparanoia/plugins/rsc.py @@ -42,8 +42,7 @@ class RoyalSocietyOfChemistry(Plugin): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # check each object in the pdf diff --git a/pdfparanoia/plugins/sciencemagazine.py b/pdfparanoia/plugins/sciencemagazine.py index 32c25eb..b4e5c5c 100644 --- a/pdfparanoia/plugins/sciencemagazine.py +++ b/pdfparanoia/plugins/sciencemagazine.py @@ -27,8 +27,7 @@ class ScienceMagazine(Plugin): pdf = parse_content(content) # get a list of all object ids - xrefs = pdf._parser.read_xref() - xref = xrefs[0] + xref = pdf.xrefs[0] objids = xref.get_objids() # check each object in the pdf