• This repository has been archived on 15/Apr/2024
  • Stars
    star
    5,237
  • Rank 7,898 (Top 0.2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 14 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python PDF Parser (Not actively maintained). Check out pdfminer.six.

PDFMiner

PDFMiner is a text extraction tool for PDF documents.

Build Status PyPI

Warning: As of 2020, PDFMiner is not actively maintained. The code still works, but this project is largely dormant. For the active project, check out its fork pdfminer.six.

Features:

  • Pure Python (3.6 or above).
  • Supports PDF-1.7. (well, almost)
  • Obtains the exact location of text as well as other layout information (fonts, etc.).
  • Performs automatic layout analysis.
  • Can convert PDF into other formats (HTML/XML).
  • Can extract an outline (TOC).
  • Can extract tagged contents.
  • Supports basic encryption (RC4 and AES).
  • Supports various font types (Type1, TrueType, Type3, and CID).
  • Supports CJK languages and vertical writing scripts.
  • Has an extensible PDF parser that can be used for other purposes.

How to Use:

  1. > pip install pdfminer
  2. > pdf2txt.py samples/simple1.pdf

Command Line Syntax:

pdf2txt.py

pdf2txt.py extracts all the texts that are rendered programmatically. It also extracts the corresponding locations, font names, font sizes, writing direction (horizontal or vertical) for each text segment. It does not recognize text in images. A password needs to be provided for restricted PDF documents.

> pdf2txt.py [-P password] [-o output] [-t text|html|xml|tag]
             [-O output_dir] [-c encoding] [-s scale] [-R rotation]
             [-Y normal|loose|exact] [-p pagenos] [-m maxpages]
             [-S] [-C] [-n] [-A] [-V]
             [-M char_margin] [-L line_margin] [-W word_margin]
             [-F boxes_flow] [-d]
             input.pdf ...
  • -P password : PDF password.
  • -o output : Output file name.
  • -t text|html|xml|tag : Output type. (default: automatically inferred from the output file name.)
  • -O output_dir : Output directory for extracted images.
  • -c encoding : Output encoding. (default: utf-8)
  • -s scale : Output scale.
  • -R rotation : Rotates the page in degree.
  • -Y normal|loose|exact : Specifies the layout mode. (only for HTML output.)
  • -p pagenos : Processes certain pages only.
  • -m maxpages : Limits the number of maximum pages to process.
  • -S : Strips control characters.
  • -C : Disables resource caching.
  • -n : Disables layout analysis.
  • -A : Applies layout analysis for all texts including figures.
  • -V : Automatically detects vertical writing.
  • -M char_margin : Speficies the char margin.
  • -W word_margin : Speficies the word margin.
  • -L line_margin : Speficies the line margin.
  • -F boxes_flow : Speficies the box flow ratio.
  • -d : Turns on Debug output.

dumppdf.py

dumppdf.py is used for debugging PDFs. It dumps all the internal contents in pseudo-XML format.

> dumppdf.py [-P password] [-a] [-p pageid] [-i objid]
             [-o output] [-r|-b|-t] [-T] [-O directory] [-d]
             input.pdf ...
  • -P password : PDF password.
  • -a : Extracts all objects.
  • -p pageid : Extracts a Page object.
  • -i objid : Extracts a certain object.
  • -o output : Output file name.
  • -r : Raw mode. Dumps the raw compressed/encoded streams.
  • -b : Binary mode. Dumps the uncompressed/decoded streams.
  • -t : Text mode. Dumps the streams in text format.
  • -T : Tagged mode. Dumps the tagged contents.
  • -O output_dir : Output directory for extracted streams.

TODO

  • Replace STRICT variable with something better.
  • Improve the debugging functions.
  • Use logging module instead of sys.stderr.
  • Proper test cases.
  • PEP-8 and PEP-257 conformance.
  • Better documentation.
  • Crypto stream filter support.

Related Projects

More Repositories

1

pyrexecd

Standalone SSH server for Windows
Python
221
star
2

planpathplat

Experimental Path Planning for Platformer
ActionScript
33
star
3

vgaplayer

Open source player for Adobe Flash Media Server streams (RTMP)
ActionScript
28
star
4

nn1

Convolutional Neural Network in C (for educational purposes)
C
19
star
5

introdl

Deep Learning Online Course (in Japanese)
HTML
18
star
6

euskit

Game engine designed for game jams. Suitable for quick prototyping of 2D games.
TypeScript
17
star
7

openssh-jman

Japanese translation of OpenSSH manual pages
Groff
13
star
8

pyntch

Python static analyzer
Python
11
star
9

pymwp

Python MediaWiki parser
Python
8
star
10

how-to-read

Japanese Translation of "How to Read a Paper"
8
star
11

pytcdb

A Python implementation of cdb/tcdb reader and writer.
Python
7
star
12

fgyama

Static source code analyzer that extracts an interprocedural dataflow graph from Java source code.
Java
7
star
13

whebap

Whebap is a Web application nanoframework.
Python
6
star
14

mcproxy

Minecraft Logging Proxy
Python
5
star
15

slides

Various slides.
HTML
5
star
16

python3-toys

Random Programs written in Python 3.
Python
5
star
17

shoveler

Lightweight Japanese speech synthesizer (text-to-speech engine).
Python
4
star
18

clipwatcher

Clipboard Watcher for Win32
C++
4
star
19

tablebot

tablebot by Tijn
JavaScript
3
star
20

wavetool

Audio manupulation/analysis tools.
Python
3
star
21

pushmo-solver

Python script to solve a Pushmo puzzle.
Rust
3
star
22

tenjer

Japanese Braille Translator
Python
3
star
23

cmonitor

Lightweight load/network/memory monitor for X11/Xt.
C
3
star
24

python-netstring

Python implementation of a netstring parser.
Python
3
star
25

nlcrypt

NLCrypt is an attempt to create a cryptography system that doesn't look like a cryptography.
Python
2
star
26

euskecs

Lecture notes for introduction to Computer Science
HTML
2
star
27

codecam

CodeCAM - Capturing programmer's reactions during a coding session.
Python
2
star
28

jscs

JavaScript Cheat Sheet
JavaScript
2
star
29

euske.github.io

Stuff
2
star
30

genwav

Python tool/framework to generate a wave file
Python
1
star
31

ytproxy

A derpy YouTube proxy for local network.
JavaScript
1
star
32

mcscanmap

Minecraft World Activity Monitor via pigmap
Python
1
star
33

hum2midi

Create a MIDI file from a hum.
Python
1
star
34

wellplayed

MiniLD 73 Game
TypeScript
1
star
35

syncdir

Yet another file/directory synchronization tool written in Python.
Python
1
star
36

platedit

Platformer + Text Editor. (LD41 submission)
TypeScript
1
star
37

ld35

The entire game code and assets for my LD35 game.
TypeScript
1
star
38

ascs

Action Script Cheat Sheet
ActionScript
1
star
39

filemgr

Simplistic file uploader
Python
1
star
40

pyone

Python One-liner Helper
Python
1
star
41

ld38

Dot - a game made for LD38
TypeScript
1
star
42

typescript-mode

An attempt to create a lean mode for editing TypeScript in Emacs
Emacs Lisp
1
star
43

github-data-2014

GitHub Data Challenge 2014
1
star
44

diehard

A simplistic CPU designing game
TypeScript
1
star
45

derpyolo

A derpy Python implementation of YOLO object detection (mixture of v1 and v2).
Python
1
star
46

wavtouch

視覚障害者向け教材「音の形をさわってみよう」
Python
1
star
47

sof

Street of Frage
ActionScript
1
star
48

spring-todoApp

Sample Spring Boot App
Kotlin
1
star