janedoesrepo / pdfreader Goto Github PK
View Code? Open in Web Editor NEWExtracting Semi-Structured Data from PDFs on a large scale
License: MIT License
Extracting Semi-Structured Data from PDFs on a large scale
License: MIT License
Describe the bug
Hi I'm getting this error when running the first two cells of the notebook.
I'm using Python3, so I have read that I should replace mode="rb" with mode="r", but still getting
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 1: invalid start byte
as error.
TypeError Traceback (most recent call last)
<ipython-input-97-9595bf47c47f> in <module>
29
30 example_file = data_dir / "test.pdf"
---> 31 page_layouts = extract_page_layouts(example_file)
32 print("Number of pages: %d" % len(page_layouts))
<ipython-input-97-9595bf47c47f> in extract_page_layouts(file)
23 layouts = []
24 for page in PDFPage.create_pages(document):
---> 25 interpreter.process_page(page)
26 layouts.append(device.get_result())
27
/mnt/hd1/marsella/law_unpacker/venv/lib/python3.6/site-packages/pdfminer/pdfinterp.py in process_page(self, page)
893 ctm = (1, 0, 0, 1, -x0, -y0)
894 self.device.begin_page(page, ctm)
--> 895 self.render_contents(page.resources, page.contents, ctm=ctm)
896 self.device.end_page(page)
897 return
/mnt/hd1/marsella/law_unpacker/venv/lib/python3.6/site-packages/pdfminer/pdfinterp.py in render_contents(self, resources, streams, ctm)
906 self.init_resources(resources)
907 self.init_state(ctm)
--> 908 self.execute(list_value(streams))
909 return
910
/mnt/hd1/marsella/law_unpacker/venv/lib/python3.6/site-packages/pdfminer/pdfinterp.py in execute(self, streams)
922 if isinstance(obj, PSKeyword):
923 name = keyword_name(obj)
--> 924 method = 'do_%s' % name.replace('*', '_a').replace('"', '_w')\
925 .replace("'", '_q')
926 if hasattr(self, method):
TypeError: a bytes-like object is required, not 'str'
Desktop (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.