NaivePDF
yet another pdf texts and tables extractor
This project is inspired by pdfminer, and the pdf parts use, rewrite or redesign a lots of it's codes.
The main purpose of this project is to provide a tool that can naively extract text lines and bordered tables from pdf files, and write them into a html file. In most cases it works well.
On the other hand, it's pdf parts can be an alternative of pdfminer that you can use it to extract texts, lines and shapes more simply.
How to Install
- Python3.6+ required
pip install naivepdf
Example of Use
very simple to use
# encoding: utf-8
from naivepdf.pdfdocument import PDFDocument
from naivepdf.reconstructor import PageReconstructor
from naivepdf.utils.html import html
def main():
with open('examples/1206061047.pdf', 'rb') as fp:
data = []
doc = PDFDocument(fp)
for i, page in enumerate(doc.pages):
# as an alternative of pdfminer, just:
# data.append(page.data)
reconstructor = PageReconstructor(page)
data.extend(reconstructor.reconstruct())
# as an alternative of pdfminer, just:
# return data
with open('examples/1206061047.html', 'w', encoding='utf-8') as fp:
html(fp, data)
if __name__ == '__main__':
main()
Metadata
Release files for naivepdf 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| naivepdf-0.3.tar.gz | 3.0 MB | Details |
Release files / naivepdf-0.3.tar.gz
| Download URL | naivepdf-0.3.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a7cf79e57faa91df8ee5708c2c20e13595f55e4a27989756b6f05f2bb304193
|
|
BLAKE2b-256 checksum How to use checksums |
2d2657975d41b55a58a48c36ac563f28e154ad03187b55b5afaf8360c9297aed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|