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': <PDFObjRef:152>.
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 <dimitrios.tsolakidis@vialink.fr>
Co-authored-by: Pieter Marsman <pietermarsman@gmail.com>
pull/484/head^2
EucliTs0 2020-10-25 14:34:45 +01:00 committed by GitHub
parent 178a831802
commit fc75972bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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