Skip to content

Commit

Permalink
Fix metadata extraction to correctly handle integer/floating-point va…
Browse files Browse the repository at this point in the history
…lues

Fixes #297
  • Loading branch information
samkit-jain committed Oct 27, 2020
1 parent 954dc94 commit 00b574f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/).

## [0.5.25] — Unreleased
### Fixed
- Fix metadata extraction to correctly handle integer/floating-point values ([#297](https://github.com/jsvine/pdfplumber/issues/297))

## [0.5.24] — 2020-10-20
### Added
- Added `extra_attrs=[...]` parameter to `.extract_text(...)` ([c8b200e](https://github.com/jsvine/pdfplumber/commit/c8b200e)) ([#28](https://github.com/jsvine/pdfplumber/issues/28))
Expand Down
6 changes: 3 additions & 3 deletions pdfplumber/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def __init__(self, stream, pages=None, laparams=None, precision=0.001, password=
self.metadata[k] = list(map(decode_text, v))
elif isinstance(v, PSLiteral):
self.metadata[k] = decode_text(v.name)
elif isinstance(v, bool):
self.metadata[k] = v
else:
elif isinstance(v, str) or isinstance(v, bytes):
self.metadata[k] = decode_text(v)
else:
self.metadata[k] = v
self.device = PDFPageAggregator(rsrcmgr, laparams=self.laparams)
self.interpreter = PDFPageInterpreter(rsrcmgr, self.device)

Expand Down

0 comments on commit 00b574f

Please sign in to comment.