# PDFMiner
PDFMiner is a text extraction tool for PDF documents.
[![Build Status](https://travis-ci.org/euske/pdfminer.svg?branch=master)](https://travis-ci.org/euske/pdfminer)
[![PyPI](https://img.shields.io/pypi/v/pdfminer)](https://pypi.org/project/pdfminer/)
**Warning**: Starting from version 20191010, PDFMiner supports **Python 3 only**.
For Python 2 support, check out
<a href="https://github.com/pdfminer/pdfminer.six">pdfminer.six</a>.
## 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`
1. `> 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
* <a href="http://pybrary.net/pyPdf/">pyPdf</a>
* <a href="http://www.foolabs.com/xpdf/">xpdf</a>
* <a href="http://pdfbox.apache.org/">pdfbox</a>
* <a href="http://mupdf.com/">mupdf</a>
Raw data
{
"_id": null,
"home_page": "http://github.com/euske/pdfminer",
"name": "pdfminer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "pdf parser,pdf converter,layout analysis,text mining",
"author": "Yusuke Shinyama",
"author_email": "yusuke@shinyama.jp",
"download_url": "https://files.pythonhosted.org/packages/71/a3/155c5cde5f9c0b1069043b2946a93f54a41fd72cc19c6c100f6f2f5bdc15/pdfminer-20191125.tar.gz",
"platform": "",
"description": "# PDFMiner\n\nPDFMiner is a text extraction tool for PDF documents.\n\n[![Build Status](https://travis-ci.org/euske/pdfminer.svg?branch=master)](https://travis-ci.org/euske/pdfminer)\n[![PyPI](https://img.shields.io/pypi/v/pdfminer)](https://pypi.org/project/pdfminer/)\n\n**Warning**: Starting from version 20191010, PDFMiner supports **Python 3 only**.\nFor Python 2 support, check out\n<a href=\"https://github.com/pdfminer/pdfminer.six\">pdfminer.six</a>.\n\n## Features:\n\n * Pure Python (3.6 or above).\n * Supports PDF-1.7. (well, almost)\n * Obtains the exact location of text as well as other layout information (fonts, etc.).\n * Performs automatic layout analysis.\n * Can convert PDF into other formats (HTML/XML).\n * Can extract an outline (TOC).\n * Can extract tagged contents.\n * Supports basic encryption (RC4 and AES).\n * Supports various font types (Type1, TrueType, Type3, and CID).\n * Supports CJK languages and vertical writing scripts.\n * Has an extensible PDF parser that can be used for other purposes.\n\n\n## How to Use:\n\n 1. `> pip install pdfminer`\n 1. `> pdf2txt.py samples/simple1.pdf`\n\n\n## Command Line Syntax:\n\n### pdf2txt.py\n\npdf2txt.py extracts all the texts that are rendered programmatically.\nIt also extracts the corresponding locations, font names, font sizes,\nwriting direction (horizontal or vertical) for each text segment. It\ndoes not recognize text in images. A password needs to be provided for\nrestricted PDF documents.\n\n > pdf2txt.py [-P password] [-o output] [-t text|html|xml|tag]\n [-O output_dir] [-c encoding] [-s scale] [-R rotation]\n [-Y normal|loose|exact] [-p pagenos] [-m maxpages]\n [-S] [-C] [-n] [-A] [-V]\n [-M char_margin] [-L line_margin] [-W word_margin]\n [-F boxes_flow] [-d]\n input.pdf ...\n\n * `-P password` : PDF password.\n * `-o output` : Output file name.\n * `-t text|html|xml|tag` : Output type. (default: automatically inferred from the output file name.)\n * `-O output_dir` : Output directory for extracted images.\n * `-c encoding` : Output encoding. (default: utf-8)\n * `-s scale` : Output scale.\n * `-R rotation` : Rotates the page in degree.\n * `-Y normal|loose|exact` : Specifies the layout mode. (only for HTML output.)\n * `-p pagenos` : Processes certain pages only.\n * `-m maxpages` : Limits the number of maximum pages to process.\n * `-S` : Strips control characters.\n * `-C` : Disables resource caching.\n * `-n` : Disables layout analysis.\n * `-A` : Applies layout analysis for all texts including figures.\n * `-V` : Automatically detects vertical writing.\n * `-M char_margin` : Speficies the char margin.\n * `-W word_margin` : Speficies the word margin.\n * `-L line_margin` : Speficies the line margin.\n * `-F boxes_flow` : Speficies the box flow ratio.\n * `-d` : Turns on Debug output.\n\n### dumppdf.py\n\ndumppdf.py is used for debugging PDFs.\nIt dumps all the internal contents in pseudo-XML format.\n\n > dumppdf.py [-P password] [-a] [-p pageid] [-i objid]\n [-o output] [-r|-b|-t] [-T] [-O directory] [-d]\n input.pdf ...\n\n * `-P password` : PDF password.\n * `-a` : Extracts all objects.\n * `-p pageid` : Extracts a Page object.\n * `-i objid` : Extracts a certain object.\n * `-o output` : Output file name.\n * `-r` : Raw mode. Dumps the raw compressed/encoded streams.\n * `-b` : Binary mode. Dumps the uncompressed/decoded streams.\n * `-t` : Text mode. Dumps the streams in text format.\n * `-T` : Tagged mode. Dumps the tagged contents.\n * `-O output_dir` : Output directory for extracted streams.\n\n## TODO\n\n * Replace STRICT variable with something better.\n * Improve the debugging functions.\n * Use logging module instead of sys.stderr.\n * Proper test cases.\n * PEP-8 and PEP-257 conformance.\n * Better documentation.\n * Crypto stream filter support.\n\n\n## Related Projects\n\n * <a href=\"http://pybrary.net/pyPdf/\">pyPdf</a>\n * <a href=\"http://www.foolabs.com/xpdf/\">xpdf</a>\n * <a href=\"http://pdfbox.apache.org/\">pdfbox</a>\n * <a href=\"http://mupdf.com/\">mupdf</a>",
"bugtrack_url": null,
"license": "MIT",
"summary": "PDF parser and analyzer",
"version": "20191125",
"split_keywords": [
"pdf parser",
"pdf converter",
"layout analysis",
"text mining"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "822eb51838a944154027b8ca42d439e3",
"sha256": "9e700bc731300ed5c8936343c1dd4529638184198e54e91dd2b59b64a755dc01"
},
"downloads": -1,
"filename": "pdfminer-20191125.tar.gz",
"has_sig": false,
"md5_digest": "822eb51838a944154027b8ca42d439e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4173248,
"upload_time": "2019-11-25T12:02:21",
"upload_time_iso_8601": "2019-11-25T12:02:21.100976Z",
"url": "https://files.pythonhosted.org/packages/71/a3/155c5cde5f9c0b1069043b2946a93f54a41fd72cc19c6c100f6f2f5bdc15/pdfminer-20191125.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-11-25 12:02:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "euske",
"github_project": "pdfminer",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "pdfminer"
}