Merge pull request #125 from yosida95/bytes-type

Fix type of an argument to PDFFont#decode to bytes in py3
pull/123/head
Tata Ganesh 2018-03-19 11:00:10 +05:30 committed by GitHub
commit eddf861fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
import six
from .pdffont import PDFUnicodeNotDefined from .pdffont import PDFUnicodeNotDefined
@ -142,8 +145,9 @@ class TagExtractor(PDFDevice):
font = textstate.font font = textstate.font
text = '' text = ''
for obj in seq: for obj in seq:
obj = utils.make_compat_str(obj) if isinstance(obj, six.text_type):
if not isinstance(obj, str): obj = utils.make_compat_bytes(obj)
if not isinstance(obj, six.binary_type):
continue continue
chars = font.decode(obj) chars = font.decode(obj)
for cid in chars: for cid in chars: