Name | pdfdol JSON |
Version |
0.1.13
JSON |
| download |
home_page | None |
Summary | Data Object Layer for PDF data |
upload_time | 2025-02-11 17:51:07 |
maintainer | None |
docs_url | None |
author | OtoSense |
requires_python | None |
license | mit |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pdfdol
Data Object Layer for PDF data
To install: ```pip install pdfdol```
[Documentation](https://i2mint.github.io/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:
```python
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:
```python
from dol import add_decoder
page_separator = '---------------------'
FilesReader = add_decoder(PdfFilesReader, decoder=page_separator.join)
# and then
pdfs = FilesReader(folder_path)
# ...
```
If you need to concatinate a bunch of pdfs together, you can do so in many
ways. Here's one:
```python
from dol import Files
from pdfdol import concat_pdfs
s = Files('~/Downloads/cosmograph_documentation_pdfs/')
concat_pdfs(s, key_order=sorted)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pdfdol",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "OtoSense",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/dc/3d/57c5bb1061c3e01303238990c2012325bb6a4c956b7ad6e03a440482770e/pdfdol-0.1.13.tar.gz",
"platform": null,
"description": "# pdfdol\n\nData Object Layer for PDF data\n\nTo install:\t```pip install pdfdol```\n\n[Documentation](https://i2mint.github.io/pdfdol/)\n\n\n# Examples\n\nGet a dict-like object to list and read the pdfs of a folder, as text:\n\n >>> from pdfdol import PdfFilesReader\n >>> from pdfdol.tests import get_test_pdf_folder\n >>> folder_path = get_test_pdf_folder()\n >>> pdfs = PdfFilesReader(folder_path)\n >>> sorted(pdfs)\n ['sample_pdf_1', 'sample_pdf_2']\n >>> assert pdfs['sample_pdf_2'] == [\n ... 'Page 1\\nThis is a sample text for testing Python PDF tools.'\n ... ]\n\nSee that the values of a `PdfFilesReader` are lists of pages. \nIf you need strings (i.e. all the pages together) you can add a decoder like so:\n\n```python\nfrom dol import add_decoder\npage_separator = '---------------------'\npdfs = add_decoder(pdfs, decoder=page_separator.join)\n```\n\nIf you need this at the level of the class, just do this:\n\n```python\nfrom dol import add_decoder\npage_separator = '---------------------'\nFilesReader = add_decoder(PdfFilesReader, decoder=page_separator.join)\n# and then\npdfs = FilesReader(folder_path)\n# ...\n```\n\nIf you need to concatinate a bunch of pdfs together, you can do so in many\nways. Here's one:\n\n```python\nfrom dol import Files\nfrom pdfdol import concat_pdfs\n\ns = Files('~/Downloads/cosmograph_documentation_pdfs/')\nconcat_pdfs(s, key_order=sorted)\n```\n",
"bugtrack_url": null,
"license": "mit",
"summary": "Data Object Layer for PDF data",
"version": "0.1.13",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0bbe139a7ff239689043670682728ca798e357dbf5b05be2611822ddfcf27981",
"md5": "67d898b017751c35275e63f8cb0de39b",
"sha256": "2a707afe1063831b529c1aacc09c4c34e9fa93d6fa7a89d2f2335b86bcff91ab"
},
"downloads": -1,
"filename": "pdfdol-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "67d898b017751c35275e63f8cb0de39b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7934,
"upload_time": "2025-02-11T17:51:06",
"upload_time_iso_8601": "2025-02-11T17:51:06.107849Z",
"url": "https://files.pythonhosted.org/packages/0b/be/139a7ff239689043670682728ca798e357dbf5b05be2611822ddfcf27981/pdfdol-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dc3d57c5bb1061c3e01303238990c2012325bb6a4c956b7ad6e03a440482770e",
"md5": "758c50e70a81bfb5b6010cf91351b62e",
"sha256": "a985b3e65387349e4cdf198f7b532d585febbdc8ce0dad942185c7b2668ec30a"
},
"downloads": -1,
"filename": "pdfdol-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "758c50e70a81bfb5b6010cf91351b62e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6737,
"upload_time": "2025-02-11T17:51:07",
"upload_time_iso_8601": "2025-02-11T17:51:07.924375Z",
"url": "https://files.pythonhosted.org/packages/dc/3d/57c5bb1061c3e01303238990c2012325bb6a4c956b7ad6e03a440482770e/pdfdol-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 17:51:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pdfdol"
}