Skip to content

Commit

Permalink
Pass caching parameter to PDFResourceManager in high_level functions (
Browse files Browse the repository at this point in the history
#475)

* Updated high_level.py

This commit enables caching to be turned on and off rather than be always on regardless of the user input.

* Reverted params back to fix errors

* Updated CHANGELOG.md to reflect quick fix

* Update CHANGELOG.md

Co-authored-by: Pieter Marsman <pietermarsman@gmail.com>
  • Loading branch information
danich1 and pietermarsman authored Sep 10, 2020
1 parent a83f853 commit b4054ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Removed
### Fixed
- Pass caching parameter to PDFResourceManager in `high_level` functions ([#475](https://github.com/pdfminer/pdfminer.six/pull/475))

### Removed
- Remove unused rijndael encryption implementation ([#465](https://github.com/pdfminer/pdfminer.six/pull/465))

## [20200726]
Expand Down
4 changes: 2 additions & 2 deletions pdfminer/high_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def extract_text(pdf_file, password='', page_numbers=None, maxpages=0,
laparams = LAParams()

with open_filename(pdf_file, "rb") as fp, StringIO() as output_string:
rsrcmgr = PDFResourceManager()
rsrcmgr = PDFResourceManager(caching=caching)
device = TextConverter(rsrcmgr, output_string, codec=codec,
laparams=laparams)
interpreter = PDFPageInterpreter(rsrcmgr, device)
Expand Down Expand Up @@ -141,7 +141,7 @@ def extract_pages(pdf_file, password='', page_numbers=None, maxpages=0,
laparams = LAParams()

with open_filename(pdf_file, "rb") as fp:
resource_manager = PDFResourceManager()
resource_manager = PDFResourceManager(caching=caching)
device = PDFPageAggregator(resource_manager, laparams=laparams)
interpreter = PDFPageInterpreter(resource_manager, device)
for page in PDFPage.get_pages(fp, page_numbers, maxpages=maxpages,
Expand Down

0 comments on commit b4054ff

Please sign in to comment.