Skip to main content

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


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.2.tar.gz (3.0 MB view details)

Uploaded Source

File details

Details for the file naivepdf-0.2.tar.gz.

File metadata

  • Download URL: naivepdf-0.2.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

Hashes for naivepdf-0.2.tar.gz
Algorithm Hash digest
SHA256 d4dde81361ceb2fd028c5ad750d29b15fe7ba604c7c502ab519825cced2f8b01
MD5 e36c6b108ace080e92aae0893c0c7c11
BLAKE2b-256 93d899b92f026d8ff133931a21833be86bae0e8790c44354ec29fdbe82c47930

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page