Skip to main content

PDF parser

Project description

# PDFMajor

<table>
<tr>
<td>Latest Release</td>
<td>
<a href="https://pypi.org/project/pdfmajor/">
<img src="https://img.shields.io/pypi/v/pdfmajor.svg" alt="latest release" />
</a>
</td>
</tr>
</table>

PDF-Major is a fork of `PDFMiner.six`. It is meant to be a more light-weight implementation that makes fewer assumptions on the data. The ultimate goal of this project is to provide a simpler, faster and more functional library that both casual and low-level developers could build upon.

## Documentation

See documentation [here](https://asosnovsky.github.io/pdfmajor/).

## Basic Example
```py
from pdfmajor.interpreter import PageInterpreter

for page in PDFInterpreter("/path/to/pdf.pdf"):
print("page start", page.page_num)
for item in page:
print(" >", item)
print("page end", page.page_num)

```

## Why Another Fork?

`PDFMiner` was designed to run in python 2.7>, `PDFMiner.six` was written to bring cross-version support for python 2 and 3. However, after attempting to build and extend upon `PDFMiner.six` I found it rather difficult to extend and identify additional details regarding the items encoded in the pdf. This library will attempt to expose as much information as possible to end-users, without having them solely rely on to-xml or to-json exports.

## Features

* Functional extraction method based on generators
* Parse, analyze, and convert PDF documents.
* PDF-1.7 specification support. (well, almost)
* Font-Color extraction
* Shape fill and stroke color extraction
* CJK languages and vertical writing scripts support.
* Various font types (Type1, TrueType, Type3, and CID) support.
* Basic encryption (RC4) support.

**Note**: We took out the layout-analysis process in this version (there is no more LTTextHorizontal or LTTextVertical). While the mathematics behind the grouping process was sound, the coupling of the layout-analysis process with the parsing and interpretation process produced unfriendly-code. This feature could be brought back by running your own implementation of it on the `pdfmajor.interpreter.PageInterpreter` class, but at the current time is not supported.

## How to Install

### Source

* Install Python 3.6.4 or newer.
* clone this repo

`git clone https://github.com/asosnovsky/pdfmajor`
* install repo

`python setup.py install`

### Pypi
* Install Python 3.6.4 or newer.
* install repo

`pip install pdfmajor`

## Terms and Conditions

(This is so-called MIT/X License)

Copyright (c) 2018-2019 Ariel Sosnovsky <ariel at sosnovsky dot ca>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


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

pdfmajor-1.3.0.tar.gz (99.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfmajor-1.3.0-py3-none-any.whl (128.7 kB view details)

Uploaded Python 3

File details

Details for the file pdfmajor-1.3.0.tar.gz.

File metadata

  • Download URL: pdfmajor-1.3.0.tar.gz
  • Upload date:
  • Size: 99.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for pdfmajor-1.3.0.tar.gz
Algorithm Hash digest
SHA256 879960a1e765989332e9b4def3516bac67bc65df8ff6bacc3bbf41d5ae9028a5
MD5 bac7a4396c613e097fa71c365e56b76e
BLAKE2b-256 469dafe491884b7b30369ef5d074dd331d6534cdf2e00f2eadff02d4e084b3b3

See more details on using hashes here.

File details

Details for the file pdfmajor-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pdfmajor-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 128.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for pdfmajor-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b323d3b87f6e663a7675080a7e6863faa700135bcd795a1ba2eaea1f20aa74b2
MD5 34d4bbc10db3c9671db9b2beb791105f
BLAKE2b-256 22d722cdee24cf672c943e39ac3979e7072a746551662ca7a91ee860d2a1f658

See more details on using hashes here.

Supported by

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