Data Object Layer for PDF data
Project description
pdfdol
Data Object Layer for PDF data
To install: pip install pdfdol
Examples
Get a dict-like object to list and read the pdfs of a folder, as text:
>>> from pdfdol import PdfFilesReader
>>> from pdfdol.tests import get_test_pdf_folder
>>> folder_path = get_test_pdf_folder()
>>> pdfs = PdfFilesReader(folder_path)
>>> sorted(pdfs)
['sample_pdf_1', 'sample_pdf_2']
>>> assert pdfs['sample_pdf_2'] == [
... 'Page 1\nThis is a sample text for testing Python PDF tools.'
... ]
See that the values of a PdfFilesReader are lists of pages.
If you need strings (i.e. all the pages together) you can add a decoder like so:
from dol import add_decoder
page_separator = '---------------------'
pdfs = add_decoder(pdfs, decoder=page_separator.join)
If you need this at the level of the class, just do this:
from dol import add_decoder
page_separator = '---------------------'
FilesReader = add_decoder(PdfFilesReader, decoder=page_separator.join)
# and then
pdfs = FilesReader(folder_path)
# ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdfdol-0.1.2.tar.gz.
File metadata
- Download URL: pdfdol-0.1.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abce6f3535e3fd70ff56c3c91d3aaa6d0d5baad5b468e76517d2da1d76d60a7c
|
|
| MD5 |
349e54743166856776a3a84b78305c97
|
|
| BLAKE2b-256 |
5d8c37bb8416bedcf8fa1ba6cb2c413a600a79e68de8ca5666d07fef7243d957
|
File details
Details for the file pdfdol-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pdfdol-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d8bc6cd10f26bb2d0bf63bf42adf5d0a071a4c5bc1ef6d47a9ec3f5e152b0d8
|
|
| MD5 |
418e9109f65f58c7152bbb1a8c40c74c
|
|
| BLAKE2b-256 |
0451e228fd5e4627561199e74ebe890bb6d5087fcab241712cfe6553dfb27acb
|