Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preprocess.py extractpdf does not work with current version of pdfminer #370

Closed
BikeMikeAU opened this issue Feb 19, 2016 · 0 comments
Closed

Comments

@BikeMikeAU
Copy link

The API of pdfminer has changed in newer versions, requiring a small change in preprocess.py.

  1. change the imports
  2. remove process_pdf, replace with new code (3 lines)

https://github.com/euske/pdfminer#api-changes

diff of preprocess.py

@@ -323 +323,2 @@
-    from pdfminer.pdfinterp import PDFResourceManager, process_pdf
+    from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
+    from pdfminer.pdfpage import PDFPage
@@ -402 +403,3 @@
-        process_pdf(rsrcmgr, device, pdf_stream, pagenos=set(), password=password, caching=True, check_extractable=True)
+        interpreter = PDFPageInterpreter(rsrcmgr, device)
+        for page in PDFPage.get_pages(pdf_stream, password=password, caching=True, check_extractable=True):
+            interpreter.process_page(page)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants