Commit Graph

365 Commits

Author SHA1 Message Date
Jeremy Singer-Vine 7e2dc7cf75 Re-add textboxhorizontal/etc. when laparams (#359)
This commit reinstates access to higher-level layout objects (such as
`textboxhorizontal`) when `laparams` is passed to
`pdfplumber.open(...)`. Had been removed in `0.5.24` via 1f87898.

Also adds a test for this behavior.
2021-02-26 18:53:11 -05:00
Jeremy Singer-Vine 2d1e687e64 Merge pull request #363 from jsvine/drop-python-35
Prevent pip from installing the project on Python versions 3.5 and lower
2021-02-26 18:24:08 -05:00
Samkit Jain e6225b4edb Prevent pip from installing the project on Python versions 3.5 and lower 2021-02-26 23:16:04 +05:30
Jeremy Singer-Vine a019517346 Move device and interpreter into Page.layout
An initial step toward resolving issues with multithreading, but does
not fully fix the issue, as there still appears to be a race condition
in parsing the layout, resulting in incorrect results at times.
2021-02-13 18:32:20 -05:00
Jeremy Singer-Vine ac46e52e07 Fix regression in closing files opened by PDF.open 2021-02-13 15:26:30 -05:00
Jeremy Singer-Vine 002727803c Fix release date in CHANGELOG.md 2021-02-10 22:40:06 -05:00
Jeremy Singer-Vine 2caba6a1f4 Clarify meaning of .curves 2021-02-10 21:53:12 -05:00
Jeremy Singer-Vine 64efb5c88a Bump to v0.5.26 v0.5.26 2021-02-10 21:29:50 -05:00
Jeremy Singer-Vine 2e4cf105f7 Update CHANGELOG.md 2021-02-10 21:25:51 -05:00
Jeremy Singer-Vine 333dac4469 Add PR 340 to CHANGELOG 2021-02-10 10:01:50 -05:00
Jeremy Singer-Vine b1849f4193 Move __enter__/__exit__/.close to Container class
So that they apply not only to the PDF class, but to the Page class as
well. Enables things such as:

```
for page in pdf.pages:
    do_something()
    page.close()
```

... and:

```
for page in pdf.pages:
    with page:
        do_something()
```
2021-02-10 09:48:44 -05:00
Jeremy Singer-Vine 1426a84f5a Move troubleshooting/Q&A to "Discussions"
- Makes this clearer in README.md
- Removes the "troubleshooting" issue template
- Adds a .github/ISSUE_TEMPATE/config.yml that disables blank issues and
  directs non-bug, non-feature-request discussions to the Discussions
  forum
2021-02-05 10:04:20 -05:00
Jeremy Singer-Vine 4d0ccd0958 Merge pull request #340 from arlyon/patch-1
Rework the alpha conversion to remove jaggies
2021-01-27 17:34:41 -05:00
Alexander Lyon f7ad9be957 Rework the alpha conversion to remove jaggies 2021-01-24 23:25:39 +01:00
Jeremy Singer-Vine 40a6c540a4 Merge pull request #338 from jsvine/issue-336
Sort tables extracted on a page by their `top` position
2021-01-21 21:58:55 -05:00
Samkit Jain a17c5a72b6 Sort tables extracted on a page by their top position
Fixes #336
h/t @gqh1995 for reporting
2021-01-21 20:05:29 +05:30
Jeremy Singer-Vine de767c3a52 Merge pull request #327 from jsvine/format-tests
Format tests according to psf/black and flake8
2020-12-17 08:24:13 -05:00
Jeremy Singer-Vine d234f05c13 Enforce psf/black and flake8 on tests/ 2020-12-16 22:30:44 -05:00
Jeremy Singer-Vine b4b0282730 Make tests flake8-compatible 2020-12-16 22:29:51 -05:00
Jeremy Singer-Vine 5c62be2e16 Format all tests with psf/black 2020-12-16 22:19:17 -05:00
Jeremy Singer-Vine 332f973c54 Bump to v0.5.25 v0.5.25 2020-12-09 09:19:07 -05:00
Jeremy Singer-Vine f4b046c7c0 Update CHANGELOG.md 2020-12-09 09:18:27 -05:00
Jeremy Singer-Vine f6c7052039 Tiny tweak to markdown in code comment 2020-12-09 09:05:27 -05:00
Jeremy Singer-Vine f2c510dcd2 Merge pull request #320 from jsvine/issue-316
Code and commits by @samkit-jain:

* Treat invalid/unparseable metadata values as warnings — Certain invalid values if parseable don't throw a warning and only unparseable (always invalid) throw

* Recursively parse metadata values to handle nested `PDFObjRef` objects — Fixes #316

* Resolve lint issues and remove unused imports

* Make metadata parse failure handling behaviour configurable

* Update tests to bump up test coverage

* Update changelog

Co-authored-by: Samkit Jain <15127115+samkit-jain@users.noreply.github.com>
2020-12-09 09:03:13 -05:00
Samkit Jain e849cbb784 Update changelog 2020-12-08 23:40:32 +05:30
Samkit Jain 02656b29c8 Update tests to bump up test coverage 2020-12-08 22:48:37 +05:30
Samkit Jain d352280fe0 Make metadata parse failure handling behaviour configurable 2020-12-08 22:38:22 +05:30
Samkit Jain 4ccf8cff67 Resolve lint issues and remove unused imports 2020-11-29 16:29:14 +05:30
Samkit Jain 2d9415cdd0 Recursively parse metadata values to handle nested PDFObjRef objects
Fixes #316
2020-11-29 15:41:01 +05:30
Samkit Jain 9f0a1ad7cd Treat invalid/unparseable metadata values as warnings
Certain invalid values if parseable don't throw a warning and only unparseable (always invalid) throw
2020-11-26 21:58:49 +05:30
Jeremy Singer-Vine d3b84da33c Update CHANGELOG.md with latest fixes 2020-11-12 23:04:54 -05:00
Jeremy Singer-Vine 408605f01a Prevent .open(...) from closing ext. file objects
Fixes #312. Now only closes pdfplumber-created streams, not file objects
passed to pdfplumber.open(...).
2020-11-12 23:02:08 -05:00
Jeremy Singer-Vine f398f46c68 Add missing metadata to setup.py 2020-11-12 22:32:58 -05:00
Jeremy Singer-Vine 7854328418 Specify encoding="utf-8" in setup.py loaders
Fixes #304
2020-11-12 22:16:54 -05:00
Jeremy Singer-Vine eb73b06f40 Merge pull request #298 from jsvine/int-float-metadata
Handle integer/floating type metadata values
2020-11-01 18:06:35 -05:00
Samkit Jain 3030765036 Add test for issue #297
h/t @prgx-csmith01 for providing the PDF
2020-10-30 12:47:27 +05:30
Samkit Jain cb324789fe Fix metadata extraction to correctly handle integer/floating-point values
Fixes #297
2020-10-30 12:47:06 +05:30
Jeremy Singer-Vine 954dc94563 Bump to v0.5.24 and update CHANGELOG.md v0.5.24 2020-10-20 09:44:01 -04:00
Jeremy Singer-Vine f665863daf Fix test_table.py ValueError tests
They were erroring on wrong aspect, because PDF object was being passed
instead of Page object.
2020-10-20 09:42:23 -04:00
Jeremy Singer-Vine bc407790f1 Decimalize "simple" explicit_h/v_lines descs (#290)
... in TableFinder. This way, you can pass ints/floats without
pre-converting them to Decimal objects.
2020-10-20 09:41:49 -04:00
Jeremy Singer-Vine 9cf15914ca Merge pull request #294 from jsvine/fix/dedup-chars
Fix bug in `dedup_chars()` in which `._objects` was accessed before assignment
2020-10-20 08:47:25 -04:00
Samkit Jain b132d45db5 Fix bug in dedup_chars() in which ._objects was accessed before assignment
Fixes #293
2020-10-20 17:02:07 +05:30
Jeremy Singer-Vine 04fd56ac40 Add utils/page.dedupe_chars(...) (#71 + #280)
h/t @xv44586 for the initial inspiration 👍

These new methods return a version of the chars/page with duplicate
chars — those sharing the same text, fontname, size, and positioning
(within `tolerance` x/y) as other characters — removed.
2020-10-03 12:06:48 -04:00
Jeremy Singer-Vine eeacbe9faa Merge branch 'stable' into develop 2020-10-03 11:54:08 -04:00
Jeremy Singer-Vine 3afd08620f Merge pull request #282 from jsvine/update-trigger-action
Update GitHub Actions to run on pull request events
2020-10-03 11:51:21 -04:00
Samkit Jain ee69b69871 Update GitHub Actions to run on pull request events
In #279 `pull_request_target` was added which is now replaced with just `pull_request`
2020-10-01 21:33:40 +05:30
Jeremy Singer-Vine e810a4a3d3 Merge branch 'stable' into develop 2020-09-29 23:59:13 -04:00
Jeremy Singer-Vine c95f4fd058 Merge pull request #279 from jsvine/fix/fork-repo-workflow-run
Allow GitHub Actions workflow to run on pull requests from forked repos
2020-09-29 23:58:51 -04:00
Jeremy Singer-Vine ec9a0bf108 Merge branch 'stable' into fix/fork-repo-workflow-run 2020-09-29 23:53:22 -04:00
Jeremy Singer-Vine 6b8a590373 Pin psf/black and flake8 dependencies 2020-09-29 23:51:24 -04:00