Commit Graph

89 Commits

Author SHA1 Message Date
Jeremy Singer-Vine 08cf2ec8e1 Link extra_attrs documentation to list of props
h/t @samkit-jain for the suggestion
2020-08-30 13:29:51 -04:00
Jeremy Singer-Vine c8b200ee7c Refactor .extract_words and allow attrib-grouping
This commit refactors and hopefully makes clearer the logic in
utils.extract_words. It also adds a new parameter, `extra_attrs`, which
allows the user to pass a list of attributes on which to group all
characters.

For instance, passing `extra_attrs=["fontname", "size"]` will not allow
characters with different font names or sizes to become part of the same
word. As a benefit, those resulting word dicts will contain `"fontname"`
and `"size"` attributes — providing a long-requested feature (cf. issue
2020-08-29 16:05:31 -04:00
Jeremy Singer-Vine 8e74cb9553 Remove reference/access to .figures
Per diagram and explanation in [1], LTFigure is just a layout-estimated
collation of LTCurve objects. For consistency with the rest of
pdfplumber, removing it from the list of parsed/accessible objects,
although we still do process the curves within each figure.

[1] https://github.com/pdfminer/pdfminer.six/blob/develop/docs/source/topic/converting_pdf_to_text.rst
2020-08-26 08:49:30 -04:00
Jeremy Singer-Vine 59a7dd2100 [docs] Note PyMuPDF's lack of easy shape-access 2020-08-25 22:18:40 -04:00
Jeremy Singer-Vine 9b40f35f0a [docs] Fix typo 2020-08-21 09:46:08 -04:00
Jeremy Singer-Vine e2539786b5 [docs] Add comparison to other libraries (#257)
Thanks to @MartinThoma for the idea.
2020-08-21 09:32:41 -04:00
Jeremy Singer-Vine c2f92a9a8e [docs] Tweak note re. former Python 3.5 support 2020-08-21 09:32:07 -04:00
Jeremy Singer-Vine 4f60d9e3bb Remove .travis.yml & link README to Actions tests 2020-08-15 12:13:37 -04:00
Samkit Jain baf103307b Drop support for Python 3.5 2020-08-15 12:03:34 -04:00
Jeremy Singer-Vine 798a152156 [README] Remove email address, add maintainer list 2020-08-15 09:18:40 -04:00
Jeremy Singer-Vine d8a2f93098 Fix: Raise ValueError on crop w/ zero-overlap bbox
h/t @samkit-jain for catching, per example in #245
2020-08-15 09:18:00 -04:00
Jeremy Singer-Vine 047ad345b4 Add relative param to .crop & err on invalid boxes
Addresses https://github.com/jsvine/pdfplumber/issues/245

Also adds `relative` param to .within_bbox, and adds a new
utils.calculate_area(bbox) method.
2020-08-13 22:25:58 -04:00
Jeremy Singer-Vine 853aea2f2b Reflect (prior) shift to using only pdfminer.six 2020-08-13 08:40:07 -04:00
Jeremy Singer-Vine cbc91c67d0 Add convert.py/.to_json/.to_csv & improve testcov
Moves most of the logic previously in cli.py to convert.py, for usage by
other submodules. Adds Container.to_json and Container.to_csv. Makes
adjustments/fixes to other parts of the library, based on edge-cases
encountered (such as infinite recursion in anntations).
2020-08-13 08:37:46 -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 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 ad94ed8506 Fix codecov badge 2020-07-25 10:49:00 -04:00
Jeremy Singer-Vine 9e42dc3890 Add badges to README.md, tweak README.md header 2020-07-25 10:39:23 -04:00
Jeremy Singer-Vine e99a664701 Fix .extract_text/words default tolerance @ README 2020-07-19 10:45:18 -04:00
Jeremy Singer-Vine 9eb5c4b825 Bump to v0.5.22 2020-07-18 12:52:51 -04:00
Jeremy Singer-Vine 0731d6059d Explicitly mention .image and .figuer objects
See https://github.com/jsvine/pdfplumber/issues/219
2020-06-24 22:47:45 -04:00
Jeremy Singer-Vine 7c84090f59 Bump to v0.5.21 2020-05-27 22:25:12 -04:00
Jeremy Singer-Vine 81104301cb Bump to v0.5.20 2020-04-29 09:31:07 -04:00
Jeremy Singer-Vine 9c4329d116 Bump to v0.5.19 2020-04-16 14:37:41 -04:00
Jeremy Singer-Vine 830d11700a Improve utils.decimalize performace [h/t ubmarco]
See: https://github.com/jsvine/pdfplumber/issues/197
2020-04-16 14:34:10 -04:00
Jeremy Singer-Vine dead89c86d Bump to v0.5.18 2020-04-01 23:36:21 -04:00
Jeremy Singer-Vine d68e8813be Consist. handle edge-ish objects for table-finding
Allow lines/rects/curves to be passed as "explicit_..._lines" params.

Fixes https://github.com/jsvine/pdfplumber/issues/127
2020-04-01 23:34:36 -04:00
Jeremy Singer-Vine 0712711a36 Bump to version 0.5.17 2020-04-01 09:17:24 -04:00
Jeremy Singer-Vine 8a5d858b60 Improve/fix extract_text bug, esp. re. vert. text
Previously, utils.extract_text(...) returned incorrect results in
certain cases when vertical text was present, as observed in
https://github.com/jsvine/pdfplumber/pull/192. This commit fixes that
by first segregating vertical and horizontal text (via "upright" char
attribute) before clustering characters.

It also adds two parameters, horizontal_ltr and vertical_ttb, to give
users control over whethere words are meant to be read left-to-right
and/or top-to-bottom vs. their opposites.
2020-04-01 09:13:18 -04:00
Jeremy Singer-Vine 56f96d8693 Add @cheungpat to acknowledgments
See https://github.com/jsvine/pdfplumber/pull/179
2020-03-29 20:46:11 -04:00
Jeremy Singer-Vine 76bd81815b Bump to v0.5.16 and update CHANGELOG 2020-01-12 23:09:07 -05: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 8c8e424c65 Fix README typo (h/t @choiasher) + nix v0.6.0 note 2019-12-06 09:02:17 -05:00
Jeremy Singer-Vine 0d3c83ea77 Move visual-debug dependencies & note ghostscript
Addresses https://github.com/jsvine/pdfplumber/issues/144
2019-10-14 22:40:54 -04:00
Jeremy Singer-Vine e8159355ba Bump to version 0.5.14 2019-10-06 18:07:52 -04: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 4ef679d6d7 Add test for PR 136 and bump version 2019-08-29 19:05:23 -04:00
Geoff Hing 693b210aaa Indicate that extracting form fields is an example
The snippet I added to the README won't cover cases like nested fields,
so set expectations accordingly.
2019-07-24 10:00:57 -05:00
Geoff Hing f5d4347d83 Document accessing form data
Form values in PDF files are handled differently than other text, so
it's not supported through the existing pdfminer APIs, but it can be
access through pdfminer's wrapping of pdfplumber.

Add a section to the README to save others the confusion I faced when
figuring out how to access form data.

Addresses #120
https://github.com/jsvine/pdfplumber/issues/120
2019-07-22 20:28:04 -05:00
Jeremy Singer-Vine 8fa335247f Merge branch 'master' of github.com:jsvine/pdfplumber 2019-04-14 23:37:49 -04:00
Jeremy Singer-Vine 4d015fe4f0 Bump to v0.5.12 2019-04-14 23:22:33 -04:00
Jeremy Singer-Vine 96b2e124aa Add troubleshooting note for ImageMagick on Debian
Thanks to @parikls via https://github.com/jsvine/pdfplumber/issues/87
2019-04-14 23:19:29 -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
Asaf 0b17c4b692 pages variable typo in example
my_pdf.page[0] => my_pdf.pages[0]
2019-01-23 13:38:53 +02:00
Jeremy Singer-Vine b2fbb9dd24 Bump to v0.5.11 2018-11-13 23:14:53 -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 eb8aef5eb1 Bump to v0.5.10 and update changelog 2018-08-03 09:54:58 -04:00
Jeremy Singer-Vine 62f5cec92c Add another thanks! 2018-08-03 09:54:42 -04:00
Jeremy Singer-Vine 21fa0f9345 Update acknowledgments. (Thanks!) 2018-08-02 22:42:29 -04:00