Commit Graph

45 Commits

Author SHA1 Message Date
Jeremy Singer-Vine d16aa13ca2 Fix utils.extract_words & .resize_object, + tests
- Fixes `.extract_words`, which had been returning incorrect results when `horizontal_ltr = False`
- Fixes `.resize_object`, which had been failing in various permutations
- Brings utils.py test coverage to 100%
2020-08-01 12:27:07 -04:00
Jeremy Singer-Vine 8e2a166c56 Add coverage for one missing pdf.page method 2020-08-01 10:21:17 -04:00
Jeremy Singer-Vine e7bd308fea Refactor DerivedPage classes & fully test page.py
Previously, classes were being defined dynamically, in a confusing
manner. This new logic should be easier to understand.

This commit also adds a few assertions that bring coverage for page.py
to 100%.
2020-08-01 09:19:27 -04:00
Jeremy Singer-Vine aa03961291 Add .annots and .hyperlinks, replacing .annos
.annos was non-functional, based on a misunderstanding of how
Annotation objects were represented in the PDF object. Also shifts
language from "annos" to "annots" to mirror pdfminer's nomenclature.
2020-07-31 18:02:04 -04:00
Jeremy Singer-Vine c5e5f4b6a9 Add open(path, pages = [...]) test 2020-07-29 23:01:00 -04:00
Jeremy Singer-Vine aede6c259c Add a few more tests 2020-07-26 15:58:06 -04:00
Jeremy Singer-Vine f4aa428334 Add tests for file-loading 2020-07-26 15:46:17 -04:00
Jeremy Singer-Vine 00e789bf42 Shift to making pdfplumber.open the sole loader
- .from_path is now removed
- .load is marked as deprecated, to be removed in 0.6.0
2020-07-26 15:27:51 -04:00
Jeremy Singer-Vine 1ac16dd369 Change testing framework from nosetests to pytest 2020-07-25 08:45:17 -04:00
Jeremy Singer-Vine cddbff74e5 Upgrade pdfminer.six==20200517 and adjust tests
New pdfminer.six version includes some improvements to layout analysis,
and especially char sizes. Tests tweaked accordingly.
2020-07-18 12:50:12 -04:00
Jeremy Singer-Vine 0254da3a47 Merge branch 'idan-david/master' 2020-07-18 11:19:34 -04:00
Idan David 334a49b74c Add test for LTChar colors 2020-05-31 12:14:25 +03:00
Jeremy Singer-Vine d64afa8c2a Fix Page.extract_table(...) when no table found
Return None instead of crashing.

Fixes https://github.com/jsvine/pdfplumber/issues/216
2020-05-27 22:24:23 -04:00
Jeremy Singer-Vine 85f422d001 Fix bug in pdfminer.six's .resolve_all
See https://github.com/jsvine/pdfplumber/issues/203

Root cause of decimalization bug flagged in that issue was
pdfminer.six's .resolve_all method not recusively resolving items within
tuples. Now we define our own method, with some slight optimization
tweaks.
2020-04-29 08:31:39 -04:00
Samkit Jain 0edc6bfadc add missing object type rect_edge to obj_to_edges() 2020-04-07 20:10:18 +05:30
Kwok-kuen Cheung 8d6e52a43c Fix #124 opening PDF with bytes stream 2020-02-05 22:36:19 +08:00
Jeremy Singer-Vine df00787ada Prevent custom LAParams from raising exception
Issue #168 / PR #169. Many thanks to @frascuchon for submitting the PR,
which is the source for the code/idea in this commit.
2020-01-12 23:08:58 -05:00
Jeremy Singer-Vine 6c2e474490 Update pdfminer.six/pillow reqs & bump to v0.5.15 2020-01-05 21:33:49 -05:00
Jeremy Singer-Vine b83afee9fb Add test for PR 138 and thank @samkit-jain 2019-10-06 17:59:39 -04:00
Jeremy Singer-Vine 56a3ac7f2f Fix .extract_table() sorting bug (#140) 2019-10-06 17:41:31 -04:00
Jeremy Singer-Vine 4ef679d6d7 Add test for PR 136 and bump version 2019-08-29 19:05:23 -04:00
Jeremy Singer-Vine 6f70d0937a Add support for parsing password-protected PDFs
Thanks to @nikhilbhawsinka for raising the question in
https://github.com/jsvine/pdfplumber/issues/101

Test PDF via https://www.novapdf.com/pdf-example-files-created-with-novapdf-kb.html
2019-04-14 23:19:16 -04:00
Jeremy Singer-Vine 5843cd7572 Improve PDFObjRef resolution and object conversion
More robust solutions to:

- https://github.com/jsvine/pdfplumber/pull/77
- https://github.com/jsvine/pdfplumber/issues/90
2018-11-11 22:28:46 -05:00
Jeremy Singer-Vine 416fda35d2 Resolve PR #77 (decimalize + PDFRefObj) 2018-11-08 22:59:39 -05:00
Jeremy Singer-Vine f8fdd27d3d Add test for PR 88 and thank @OisinMoran 2018-11-08 22:27:59 -05:00
Jeremy Singer-Vine 8ea688702d Add test for issue #67 / PR #69
Thanks to @yiqiyu for the example PDF!
2018-07-10 22:57:14 -04:00
Jeremy Singer-Vine b0f094c6f9 Don't decimalize (non_)stroking_color, fixing #53 2018-03-06 08:44:59 -05:00
Jeremy Singer-Vine c9e45ce067 Fix issue #33 by checking decode_text arg type 2017-05-10 22:52:52 -04:00
Jeremy Singer-Vine b44f2dc3bc v0.5.2
@ Added
- Access to `curve` points. (E.g., `page.curves[0]["points"]`.)
- Ability for `.draw_line` to draw `curve` points.

@ Changed
- Disaggregated "min_words_vertical" (default: 3) and "min_words_horizontal" (default: 1), removing "text_word_threshold".
- Internally, made `utils.decimalize` a bit more robust; now throws errors on non-decimalizable items.
- Now explicitly ignoring some (obscure) `pdfminer` object attributes.
- Raw input for `.draw_line` from a bounding box to `((x, y), (x, y))`, for consistency with `curve["points"]` and with `Pillow`'s underlying method.

@ Fixed
- Fixed typo bug when `.rect_edges` is called before `.edges`
2017-02-27 00:11:09 -05:00
Jeremy Singer-Vine ba9d7ab0c8 Add test for issue #13
Thanks to @jsfenfen: https://github.com/jsvine/pdfplumber/issues/13
2017-02-25 14:39:47 -05:00
Jeremy Singer-Vine 955b126b80 v0.5.0
- Completely overhauls the approach to table extraction.
- Adds visual debugging.
- See CHANGELOG.md for details.
2017-02-25 13:30:50 -05:00
Jeremy Singer-Vine fcccd8e2d3 Merge branch 'master' into develop 2017-01-26 16:21:55 -05:00
Jeremy Singer-Vine 302b8a72ad Fix resolution/decoding of list-type metadata
Big thanks to @jeffbarrera for flagging:
https://github.com/jsvine/pdfplumber/issues/14
2016-05-24 16:41:03 -04:00
Jeremy Singer-Vine 648354ac62 Switch core page ID from .pageid to .page_number
Also: Change "pageid" to "page_id". "pageid" was inherited from
pdfminer, but "page_id" is easier to read.

h/t @jsfenfen
2016-04-23 21:21:42 -04:00
Jeremy Singer-Vine ee98c6d1e8 Add test for CA WARN report, h/t @dannguyen 2016-04-23 21:06:33 -04:00
Jeremy Singer-Vine 002bcf5f75 Change default x/y tolerances from 0 to 5
Five points seems like a sane default, and appears to fit common
use-cases more frequently than zero does.
2016-04-23 21:04:58 -04:00
Jeremy Singer-Vine 34197f7d6d Rename .from_path->.open (keeping former as alias)
Enables idiomatic-ish treatment, e.g.:

with pdfplumber.open(path) as pdf:
    [do things]
2016-03-09 07:25:46 -05:00
Jeremy Singer-Vine e51118ccfa Ensure that Page subclasses have necessary attrs 2016-03-08 10:15:26 -05:00
Jeremy Singer-Vine 381bc6ba02 Add utils.filter_objects(...) and Page.filter(...) 2016-03-08 09:47:23 -05:00
Jeremy Singer-Vine 5aa8d638ae Remove empty test 2016-03-06 11:42:15 -05:00
Jeremy Singer-Vine c0e6979a98 Add test for very basic things 2016-03-06 11:41:48 -05:00
Jeremy Singer-Vine cd4aee8c49 Modularize find_gutters, and start removing pandas 2016-03-05 15:10:01 -05:00
Jeremy Singer-Vine 88b4cc2c94 Tweak tests to handle changes to .utils 2016-03-05 14:06:51 -05:00
Jeremy Singer-Vine 3a0fdad4c1 Add Los Angeles precinct bulletin test 2016-02-28 18:50:33 -05:00
Jeremy Singer-Vine 74bf8178f9 Add first test 2016-02-20 19:44:05 -05:00