Git Product home page Git Product logo

pdfreader's People

Contributors

dependabot[bot] avatar janedoesrepo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pdfreader's Issues

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 1: invalid start byte

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.

Screenshots

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):

  • OS: [e.g. linux]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.