From fc75972bbdc96cc666759ee35509499023f20519 Mon Sep 17 00:00:00 2001 From: EucliTs0 Date: Sun, 25 Oct 2020 14:34:45 +0100 Subject: [PATCH] Fix TypeError: cannot unpack non-iterable PDFObjRef object, when unpacking the value of 'DW2' (#529) Closes #518 * Fix TypeError: cannot unpack non-iterable PDFObjRef object, when unpacking the value of 'DW2' An error is occured when the 'DW2' key contains a PDFObjRef object instead of a list of int values, e.g: 'DW2': . To solve this issue, we utilise the resolve1() function See: https://github.com/pdfminer/pdfminer.six/issues/518 * Updated CHANGELOG * Update CHANGELOG.md Co-authored-by: Dimitrios TSOLAKIDIS Co-authored-by: Pieter Marsman --- CHANGELOG.md | 4 +++- pdfminer/pdffont.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af33efa..c9a02a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +- Fix issue of TypeError: cannot unpack non-iterable PDFObjRef object, when unpacking the value of 'DW2' ([#529](https://github.com/pdfminer/pdfminer.six/pull/529)) + ## Removed - Support for Python 3.4 and 3.5 ([#522](https://github.com/pdfminer/pdfminer.six/pull/522)) - Unused dependency on `sortedcontainers` package ([#525](https://github.com/pdfminer/pdfminer.six/pull/525)) - ## [20201018] ### Deprecated diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py index e1f5a5d..c0da1b6 100644 --- a/pdfminer/pdffont.py +++ b/pdfminer/pdffont.py @@ -706,7 +706,7 @@ class PDFCIDFont(PDFFont): widths = get_widths2(list_value(spec.get('W2', []))) self.disps = {cid: (vx, vy) for (cid, (_, (vx, vy))) in widths.items()} - (vy, w) = spec.get('DW2', [880, -1000]) + (vy, w) = resolve1(spec.get('DW2', [880, -1000])) self.default_disp = (None, vy) widths = {cid: w for (cid, (w, _)) in widths.items()} default_width = w