Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --format text option #1235

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

brandonrobertz
Copy link

This PR adds a --format text option to the CLI interface.

I use this regularly because pdfplumber has among the best layout preserving methods for PDFs, especially machine generated ones. Exposing the page output via CLI lets me use pdfplumber as a general purpose PDF-to-text tool.

Usage:
pdfplumber --format text file.pdf > file.txt

If there's some other way I should perform this (other than print(extract_text(...)) LMK and I'll make changes.

I use this regularly because pdfplumber has among the best layout
preserving methods for PDFs, especially machine generated ones.
Exposing the page output via CLI lets me use pdfplumber as a general
purpose PDF-to-text tool.

Usage:

pdfplumber --format text file.pdf > file.txt
@jsvine jsvine changed the base branch from stable to develop December 16, 2024 04:03
@jsvine jsvine merged commit e0ee254 into jsvine:develop Dec 16, 2024
5 checks passed
@jsvine
Copy link
Owner

jsvine commented Dec 16, 2024

Thanks! And glad to hear pdfplumber has been useful. I think this makes a lot of sense as a feature. Future iterations could allow passing relevant config params, such as --x-density, --y-density, --x-tolerance, --y-tolerance, et cetera. But even this config-less version seems worth including.

jsvine added a commit that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants