yet another pdf texts and tables extractor
Project description
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()
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
naivepdf-0.3.tar.gz
(3.0 MB
view details)
File details
Details for the file naivepdf-0.3.tar.gz
.
File metadata
- Download URL: naivepdf-0.3.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a7cf79e57faa91df8ee5708c2c20e13595f55e4a27989756b6f05f2bb304193 |
|
MD5 | efd02a3503477fbc4c817afa2655d1b1 |
|
BLAKE2b-256 | 2d2657975d41b55a58a48c36ac563f28e154ad03187b55b5afaf8360c9297aed |