Skip to content

Commit

Permalink
Fix TypeError: cannot unpack non-iterable PDFObjRef object, when unpa…
Browse files Browse the repository at this point in the history
…cking 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: #518

* Updated CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Dimitrios TSOLAKIDIS <[email protected]>
Co-authored-by: Pieter Marsman <[email protected]>
  • Loading branch information
3 people authored Oct 25, 2020
1 parent 178a831 commit fc75972
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pdfminer/pdffont.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def __init__(self, rsrcmgr, spec, strict=settings.STRICT):
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
Expand Down

0 comments on commit fc75972

Please sign in to comment.