Commit Graph

191 Commits

Author SHA1 Message Date
Jeremy Singer-Vine 8f571bb49a Remove no-longer-guaranteed test_repair assertion 2025-11-08 15:05:15 -05:00
Jeremy Singer-Vine 738f6f0198 Add test for CLI auto-help 2025-06-11 23:40:50 -04:00
Jeremy Singer-Vine 7e364e6193 Add Page.trimbox, .bleedbox, .artbox (#1313)
Thanks to @samuelbradshaw for the suggestion!
2025-06-11 23:26:26 -04:00
Jeremy Singer-Vine 4c7e092cac Upgrade pdfminer.six from 20250327 to 20250506
... and adjust color handling accordingly.
2025-06-11 23:26:26 -04:00
Jeremy Singer-Vine e15ed98a26 Fix bug w/ use_text_flow=True extractions (#1279)
... related to flows where text bounces between lines.

h/t @samuelbradshaw
2025-03-27 22:44:25 -04:00
Jeremy Singer-Vine f2ad9423fa Add another oss-fuzz test case, already fixed 2025-03-27 22:00:20 -04:00
Jeremy Singer-Vine 748ff31dd9 More broadly handle RecursionError, via oss-fuzz 2025-03-27 21:58:17 -04:00
Jeremy Singer-Vine 9148810a8f Fix unhandled None in do_PDFStream, via oss-fuzz 2025-03-27 21:57:21 -04:00
Jeremy Singer-Vine 7e28e76dd3 Remove test_issue_1089 (#1263)
@booxter makes a good point that the test is platform-specific. The
issue has been resolved, and it's not expected to return, so I think
provisionally OK to remove this test.
2025-03-25 23:03:13 -04:00
Jeremy Singer-Vine 8f5f498d8f Fix wrong exception expectation in test 2025-02-09 17:23:37 -05:00
Jeremy Singer-Vine 43ccc5b260 Catch exceptions from pdfminer and malformed PDFs
... thanks to OSS-Fuzz and @ennamarie19

Cf.: https://github.com/google/oss-fuzz/pull/12949
2025-02-09 16:25:30 -05:00
mara004 5d47d5a927 test_issue_1089: update wording regarding pypdfium2
See https://github.com/jsvine/pdfplumber/issues/1089#issuecomment-2007961627 for background
2025-02-02 16:27:53 +01:00
Jeremy Singer-Vine 078df970aa Fix #1237 (tf → table_settings) h/t @n-traore
And thanks to @cmdlineluser for the nudge.
2024-12-31 09:11:32 -05:00
Jeremy Singer-Vine 69d010a093 Add initial test/docs for format --text (#1235) 2024-12-15 23:24:31 -05:00
Jeremy Singer-Vine 28d4f50437 Merge PR #1195 2024-12-08 23:10:15 -05:00
Jeremy Singer-Vine 20731649dc Appease linter 2024-12-08 22:55:30 -05:00
Michal Stolarczyk c80c78dcf9 add a test to cover raise_unicode_errors parameter 2024-11-22 16:48:19 +01:00
Jeremy Singer-Vine 6ef62c9791 Add name property to image objects (#1201)
h/t @djr2015
2024-10-02 21:11:38 -04:00
Jeremy Singer-Vine 6e769ea66d Rerun upgrade code-formatting libraries 2024-08-07 10:40:57 -04:00
Jeremy Singer-Vine 9025c3fc56 Fix object coordinates when mediabox != (0,0,...)
See issue #1181 for details.
2024-08-05 12:28:42 -04:00
Jeremy Singer-Vine 03a477f7f0 Add pdfplumber.open(unicode_norm=...)
Allows user to pre-normalize Unicode characters.

h/t @petermr + @agusluques in #905
2024-08-04 14:11:58 -04:00
Jeremy Singer-Vine 22494e8da2 Make Page.crop(...) also crop .annots/.hyperlinks
h/t @Safrone in #1171
2024-08-04 13:14:12 -04:00
Jeremy Singer-Vine 1496cbda7d Add return_chars=True kwarg to Page.extract_words
h/t @cmdlineluser in #1173
2024-08-04 11:14:07 -04:00
Jeremy Singer-Vine d39302fa2c Add Table.columns, analogous to Table.rows (#1050)
h/t @Pk13055 for the suggestion
2024-08-02 19:00:23 -04:00
Jeremy Singer-Vine 48cab3f73e Change default .repair(...) setting h/t @Laubeee
Now passes "default" rather than "prepress" to Ghostscript's
`-dPDFSETTINGS` parameter.

Also makes that setting modifiable via `.repair(setting=...)`, where the
value is one of `"default"`, `"prepress"`, `"printer"`, or `"ebook"`.

See #874 and https://ghostscript.com/docs/9.54.0/VectorDevices.htm
2024-07-31 18:16:00 -04:00
Jeremy Singer-Vine e5737d29c2 Fix broken CroppedPage.annots/hyperlinks
Issue was caused by missing `.initial_doctop` and `.rotation`
properties. h/t @Safrone in #1171
2024-07-14 17:27:05 -04:00
QAN 1f57556201 use extra_attrs 2024-07-02 15:01:57 +02:00
QAN 76752c4a31 add ignore_char_properties arg in dedup_chars 2024-06-27 11:40:35 +02:00
Jeremy Singer-Vine 4daf0aa1b9 Handle PDFDocEncoding failures in decode_text
Fixes issue #1147
2024-06-11 16:21:45 -04:00
Jeremy Singer-Vine aaa35c9c6b Fix coordinates of annots on rotated pages
PDFs represent annotation coordinates independently from page rotation,
so annot coordinates have to be adjusted.
2024-06-11 14:52:03 -04:00
Jeremy Singer-Vine 147f2c4c07 Merge branch 'develop' of github.com:jsvine/pdfplumber into develop 2024-03-07 07:52:19 -05:00
Jeremy Singer-Vine 850fd45b02 Add {line,char}_dir{,rotated,render} params
... and in the process, deeply rewrite the text extraction code to be
more flexible with regards to reading/writing non top-to-bottom,
left-to-right text.

Major kudos and thanks to @afriedman412 for the initial idea, initial
prototype, and inspiration for these new features.

Breaking change: word["direction"] is no longer {1,-1} but instead
{"ltr","rtl","ttb","btt"}.

Deprecated: Text-extraction parameters `horizontal_ltr` and
`vertical_ttb`.
2024-03-06 20:53:03 -05:00
Jeremy Singer-Vine 1820247309 Add curve["path"] and curve["dash"]
... now that they're available in the latest pdfminer.six
2024-03-03 14:10:47 -05:00
David Huggins-Daines 207312eae7 Some utility methods for logical structure (#1095) 2024-03-02 19:44:40 -05:00
David Huggins-Daines 3e74fb134f fix: handle missing ParentTree 2024-02-14 08:52:56 -05:00
David Huggins-Daines 7322077e0f fix: placate flake8 2024-02-05 08:53:03 -05:00
David Huggins-Daines f3d20fcf35 fix: prevent pypdfium2 file leak (fixes: #1089) 2024-02-05 08:52:51 -05:00
Jeremy Singer-Vine 07d9997ee5 Standardize handling of cropbox
... fixing various issues with PageImage. Also adds
force_mediabox parameter to Page.to_image(...).

Thanks to @stefanw for flagging:
    https://github.com/jsvine/pdfplumber/issues/1054
2024-01-05 10:14:44 -05:00
Jeremy Singer-Vine fff846b073 Merge pull request #1041 from afriedman412/x_tolerance_ratio
Add `x_tolerance_ratio` param to `extract_text` and similar functions
2023-11-09 15:18:27 -05:00
Jeremy Singer-Vine 35ed9e0695 Merge pull request #963 from dhdaines/structure_tree
Support for PDF 1.3 logical structure
2023-11-09 15:08:09 -05:00
Jeremy Singer-Vine 0145647c58 Add x_tolerance_ratio test for extract_words(...) 2023-11-08 15:36:42 -05:00
Andy Friedman 1359fad7c0 adding x_tolerance_ratio functionality 2023-11-04 16:33:11 -04:00
Andy Friedman 9af84e2b5e Revert "linting"
This reverts commit c2564653e8.
2023-11-02 11:27:35 -04:00
Andy Friedman c2564653e8 linting 2023-11-01 16:13:56 -04:00
Andy Friedman 5a85ab7a0c add x_tolerance_ratio 2023-11-01 13:54:10 -04:00
Jeremy Singer-Vine 0bfffc2448 Fix Page.get_textmap caching for extra_attrs=[...]
... by preconverting list kwargs to tuples.
2023-10-27 10:53:17 -04:00
David Huggins-Daines ed707a7ec6 fix: respect use_text_flow in extract_text (fixes #982) 2023-09-06 15:51:50 -04:00
David Huggins-Daines 036044d92e fix: handle more MCR/OBJR madness 2023-09-05 23:47:23 -04:00
David Huggins-Daines 14f9a67c66 fix: complete coverage and fix handling of OBJR/MCR 2023-09-05 23:03:17 -04:00
David Huggins-Daines 8d485c38cd test: trivial synthetic pdf for completing structure coverage 2023-09-05 23:03:03 -04:00