Comments (4)
Cool, that does solve the columns issue but it removes all spaces unfortunately.
from pdftotext.
I guess it's not mentioned in the README, but it is in the help output:
$ python
>>> import pdftotext
>>> help(pdftotext.PDF)
Help on class PDF in module pdftotext:
class PDF(builtins.object)
| PDF(pdf_file, password="", raw=False) -> new PDF document
|
| Methods defined here:
|
| __getitem__(self, key, /)
| Return self[key].
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __len__(self, /)
| Return len(self).
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
Here's an example for getting the raw layout:
import pdftotext
with open("lorem_ipsum.pdf", "rb") as f:
pdf = pdftotext.PDF(f, raw=True)
for page in pdf:
print(page)
Hope it helps!
from pdftotext.
The help output could definitely make what each option does more obvious. I'll keep this issue open until I make an improvement there.
from pdftotext.
Improved the help doc in v2.1.2:
>>> import pdftotext
>>> help(pdftotext.PDF)
Help on class PDF in module pdftotext:
class PDF(builtins.object)
| PDF(pdf_file, password="", raw=False)
|
| Args:
| pdf_file: A file opened for reading in binary mode.
| password: Unlocks the document, if required. Either the owner
| password or the user password works.
| raw: If True, page text is output in the order it appears in the
| content stream, rather than in the order it appears on the
| page.
|
| Example:
| with open("doc.pdf", "rb") as f:
| pdf = PDF(f)
| for page in pdf:
| print(page)
from pdftotext.
Related Issues (20)
- Symbol not found in flat namespace HOT 8
- Two different text output is returned HOT 2
- Unable to install pdftotext : poppler/cpp/poppler-document.h not found HOT 4
- Crash when PDF contains empty pages HOT 3
- problems reading and maintaining the layout HOT 2
- AttributeError: module 'pdftotext' has no attribute 'PDF' HOT 4
- ImportError: DLL load failed while importing pdftotext: The specified module could not be found
- Import error when running on MacOs (M1) HOT 1
- Enable tests requiring at least version 0.88 if requirement is met HOT 3
- Formatting changed after new install HOT 4
- raw=False argument not working in latest version HOT 2
- Can't install this on macOS Big Sur 11.6 HOT 3
- Red hat Linux env - unable to execute 'gcc': No such file or directory HOT 4
- Fails to install on Windows with Python 3.9 HOT 1
- Extract text from scanned pdfs HOT 3
- I tried all the steps in the above column still no luck. HOT 1
- macOS: `setup.py` fails when `brew` is not in PATH HOT 1
- Add option to hide clipped text and ignore diagonal text HOT 1
- Can't import pdftotext in my Mac Apple Silicon M1 HOT 7
- question about how to approach bonding box problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdftotext.