pdf - PDFminer in Python -
i downloaded pdfminer, commandline methods work want able convert multiple pdf documents @ same time trying use pdfminer library, found os stackoverflow can't work..
from pdfminer.pdfinterp import pdfresourcemanager, process_pdf pdfminer.converter import textconverter pdfminer.layout import laparams cstringio import stringio def convert_pdf(path): rsrcmgr = pdfresourcemanager() retstr = stringio() codec = 'utf-8' laparams = laparams() device = textconverter(rsrcmgr, retstr, codec=codec, laparams=laparams) fp = file(path, 'rb') process_pdf(rsrcmgr, device, fp) fp.close() device.close() str = retstr.getvalue() retstr.close() print str convert_pdf("/users/gorkemyurtseven/desktop/casino.pdf")
when run get:
traceback (most recent call last): file "pdfminer.py", line 1, in <module> pdfminer.pdfinterp import pdfresourcemanager, process_pdf file "/users/gorkemyurtseven/desktop/pdfminer.py", line 1, in <module> pdfminer.pdfinterp import pdfresourcemanager, process_pdf importerror: no module named pdfinterp
it seems calling script pdfminer
module , goes crazy when trying import module same name.
another reasons may pdfminer
module installed incorrectly or not correct version python distribution.
Comments
Post a Comment