fix type of an argument to PDFFont#decode to bytes in py3

pull/125/head
Kohei YOSHIDA 2018-02-20 13:42:09 +09:00
parent 3e6cc20cb2
commit a636cbcfd4
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: