From 8ab2e287be67185cc120597e6785c1b81df6b842 Mon Sep 17 00:00:00 2001 From: John Kesegich Date: Mon, 25 Feb 2019 11:33:18 -0600 Subject: [PATCH] Handle PDFStream as character map name in PDFCIDFont --- pdfminer/pdffont.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py index feb8557..1487bab 100644 --- a/pdfminer/pdffont.py +++ b/pdfminer/pdffont.py @@ -16,6 +16,7 @@ from . import settings from .psparser import PSLiteral from .psparser import literal_name from .pdftypes import PDFException +from .pdftypes import PDFStream from .pdftypes import resolve1 from .pdftypes import int_value from .pdftypes import num_value @@ -654,6 +655,17 @@ class PDFCIDFont(PDFFont): if strict: raise PDFFontError('Encoding is unspecified') name = 'unknown' + if type(name) is PDFStream: + if 'CMapName' in name: + name = name.get('CMapName').name + if name == 'DLIdent-H': + name = 'Identity-H' + elif name == 'DLIdent-V': + name = 'Identity-V' + else: + if strict: + raise PDFFontError('Encoding is unspecified') + name = 'unknown' try: self.cmap = CMapDB.get_cmap(name) except CMapDB.CMapNotFound as e: