Commit Graph

190 Commits

Author SHA1 Message Date
Jeremy Singer-Vine fc2c9a9001 Fix list of tested Python versions in README #1355
Thanks to @pranjalpokharel7 for flagging.
2026-01-27 13:25:44 +01:00
Jeremy Singer-Vine d02ac571d5 Add @bronislav to thanks 2025-07-20 08:13:18 -04:00
Jeremy Singer-Vine 42a004f6b2 Add edge_min_length_prefilter table setting #1274
... for initial edge filtering. Lowering this setting enables capturing
small edge segments (e.g., dashed lines) that would be filtered out with
the default minimum length of 1. Raising this setting would be less
common but plausible.

Thanks to @bronislav for suggesting.
2025-07-20 08:08:14 -04:00
Jeremy Singer-Vine 4144426bf3 Update example CLI usage in README.md 2025-07-19 18:24:34 -04:00
Jeremy Singer-Vine b67079fb70 Add licensing info to README library comps (#1314)
h/t @mjhea0
2025-06-22 11:47:38 -04: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
Jeremy Singer-Vine 7c6354193f Add thanks to @stolarczyk in README.md 2025-01-01 10:29:53 -05:00
Jeremy Singer-Vine 6e54799542 Add thanks to @brandonrobertz (#1235) 2024-12-28 12:13:32 -05:00
Jeremy Singer-Vine 69d010a093 Add initial test/docs for format --text (#1235) 2024-12-15 23:24:31 -05:00
Guilherme 8542adb95e Fix broken link to Anssi Nurminen's master's thesis in README 2024-11-10 18:19:04 -03: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 491c8096c4 Remove consulting note from README 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 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 937702da25 Add documentation for image properties
Thanks to @leorouxx in #1172 for the suggestion and much of the content.
2024-07-14 17:11:07 -04:00
Jeremy Singer-Vine acc9082138 Tweak dedupe_chars documentation slightly 2024-07-06 16:01:42 -04:00
QAN 76752c4a31 add ignore_char_properties arg in dedup_chars 2024-06-27 11:40:35 +02:00
Jeremy Singer-Vine 469f15f7ff Add README thanks to @aronweiler 2024-06-11 16:25:51 -04:00
Jeremy Singer-Vine 2e9819c96a Update form-parsing code in README, per #1120
h/t @jeremybmerrill
2024-04-19 11:30:38 -04: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
Jeremy Singer-Vine f73fbe1c6c Add "Visually debugging the table-finder" note 2024-02-10 17:04:27 -05:00
Jeremy Singer-Vine 38150149e0 Remove "Troubleshooting ImageMagick", outdated
ImageMagick no longer used, phased out in favor of pypdfium2's image
rendering.
2024-02-10 17:00:28 -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 f4f4473a17 Change pixels->points in docs 2023-11-10 09:11:51 -05:00
Jeremy Singer-Vine 584421bd8a Fix Markdown rendering issue in docs 2023-11-10 09:09:33 -05:00
Jeremy Singer-Vine 401b82cf74 Fix docs re. keep_blank_chars in table extraction
(It is `text_keep_blank_chars`.)

h/t @Pk13055 via:
https://github.com/jsvine/pdfplumber/pull/1003#issuecomment-1805664102
2023-11-10 09:05:36 -05:00
Jeremy Singer-Vine c134e73028 Add @afriedman412 to contributors 2023-11-09 15:24:10 -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 ba58e16450 Fix Page.close() regression + docs h/t @luketudge
See https://github.com/jsvine/pdfplumber/issues/1042

- Re-adds `Page.close()` method
    - Was accidentally removed in https://github.com/jsvine/pdfplumber/commit/9587cc7d2292a1eae7a0150ab406f9365944266f
- Makes `PDF.close()` close all pages as well
- Improves relevant documentation
2023-11-09 14:13:02 -05:00
Jeremy Singer-Vine 98d970084d Add x_tolerance_ratio documentation to README.md 2023-11-08 15:47:31 -05:00
Jeremy Singer-Vine 0c7a279a3b Update CHANGELOG and README re. PR #1032 2023-10-28 09:05:54 -04:00
Jeremy Singer-Vine 529b3d8126 Merge branch 'stable' into develop 2023-10-26 09:57:08 -04:00
Hussain Shaikh 94981ce23f Update link causing 404 2023-10-21 20:38:12 +05:30
Jeremy Singer-Vine 4a76a1f3a5 Add hyperlinks and experimentality to mcid/tag notes 2023-08-19 11:38:39 -04:00
David Huggins-Daines 142fc90cc5 Support for marked content section IDs (#961) 2023-08-19 11:29:21 -04:00
Jeremy Singer-Vine 94da66c1b3 Add thanks to @jeremybmerrill 2023-08-12 17:05:21 -04:00
Jeremy B. Merrill 41498312a0 Update form-parsing example in README (#958)
Thanks to PR from @jeremybmerrill, who writes:

> This form-parsing example handles form fields recursively contained within other form fields, removes the incorrect-assumption that field-names are unique and includes the alternate field name in output (which is often a very useful guide to what's in a field).

> the prior form-parsing example used the field-name ("T" entry) as the key in the form_data dict, implicitly assuming that the field name is globally unique within a document. That's not a correct assumption; nested field names are often simply a numeric index like 1 or 0. The prior example also entirely ignored the TU entry alternate field name.
2023-08-12 17:03:39 -04:00
Jeremy Singer-Vine 7e2893106e Add antialias parameter to Page.to_image(...)
... and associated methods. Thanks to @cmdlineluser for flagging.

For details, see:
https://github.com/jsvine/pdfplumber/discussions/899#discussioncomment-6464765
2023-07-19 08:56:18 -04:00
Jeremy Singer-Vine c9d24d50b0 Remove support for Python 3.7 2023-07-16 18:22:58 -04:00
Jeremy Singer-Vine fbc6fac02f Merge branch 'develop' of github.com:jsvine/pdfplumber into develop 2023-07-16 17:39:43 -04:00
Jeremy Singer-Vine 788857ed03 Add Python 3.11 to supported versions 2023-07-16 15:40:52 -04:00
Jeremy Singer-Vine b0493732c4 Replace Wand with pypdfium2 for page.to_image(...)
This commit swaps out Wand (and its non-Python dependencies ImageMagick
and Ghostscript) for pypdfium2 for PageImage rendering. This has some
advantages:

- Less finicky: Wand often caused users problems, due to "MagickWand
  shared library not found" and "PolicyError: not authorized `PDF'"
  issues. By contrast, pypdfium2 seems (at least at first) to more
  self-contained and not require any system-tweaking.
- Faster: pypdfium2 appears to render images more quickly than Wand (see
  @cmdlineuser's tests in #899)
- More flexible: pypdfium2 appears to generate images with greater color
  depth; by default, pdfplumber quantizes those images so that they
  save/display compactly (in fact, with smaller file sizes than the
  previous code), this commit also adds parameters to retain all/more of
  the original, more detailed colors.

Thanks to @cmdlineuser in #899 for the suggestion.
2023-07-16 10:46:40 -04:00
Jeremy Singer-Vine ea5e2753df Move expanded notes on colors to docs/colors.md 2023-07-14 12:21:19 -04:00
Jeremy Singer-Vine 3772af60c7 Add Page.find_table(...) (#873)
Previously, `pdfplumber.Page` had these table-getting methods:

- `.find_tables(...)`
- `.extract_tables(...)`
- `.extract_table(...)`

For consistency/completeness's sake, this commit adds:

- `.find_table(...)`

... which, analogous to `.extract_table(...)`, returns the largest table
on the page.

Indeed, `.extract_table(...)` now uses `.find_table(...)` beneath the
hood.

Thanks to @pdille for the suggestion, here:
https://github.com/jsvine/pdfplumber/discussions/864#discussioncomment-5668209
2023-07-04 09:59:00 -04:00
Jeremy Singer-Vine 57d51bb5f4 Normalize color representation (#917)
This commit normalizes the type representation of `stroking_color` and
`non_stroking_color` values. Thanks to @dhdaines for pointing out this
inconsistency.

Previously, `pdfplumber` passed along `pdfminer.six`'s colors without
normalization. Due to quirks in `pdfminer.six`'s color handling, this
meant that those values could be floats, ints, lists, or tuples. This
commit normalizes all color values (when non-None) into n-tuples, where
(val,) represents grayscale colors, (val, val, val) represents RBG, and
(val, val, val, val) represents CMYK colors.

This should solve the consistency issue, although might cause breaking
changes to code that filters for non-tuple values — e.g., `[c for c in
page.chars if c == [1, 0 0]]`. Although breaking changes are unpleasant,
I think the tradeoff for longer-term consistency is worth it.
2023-07-03 22:59:05 -04:00
Ritchie Poh 8bf51217bc Update README.md
Fixed a small typo
2023-05-02 14:46:16 +08:00
Jeremy Singer-Vine 86e935d681 By default, expand ligatures into their letters
Addresses issue #598
2023-04-13 08:13:16 -04:00