# 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**: **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
<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>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
PDFMiner:一个用于从 PDF 文档中抽取信息的工具。 【功能】 纯 Python(3.6 或更高版本)。 支持 PDF-1.7。(嗯,差不多) 获取文本的确切位置以及其他布局信息(字体等)。 执行自动布局分析。 可以将 PDF 转换为其他格式 (HTML/XML)。 可以提取轮廓 (TOC)。 可以提取标记的内容。 支持基本加密(RC4 和 AES)。 支持各种字体类型(Type1、TrueType、Type3 和 CID)。 支持 CJK 语言和垂直编写脚本。 具有可用于其他目的的可扩展 PDF 解析器。 【使用方法】 > pip install pdfminer > pdf2txt.py samples/simple1.pdf 【命令行语法】 pdf2txt.py pdf2txt.py 提取以编程方式呈现的所有文本。 它还提取相应的位置、字体名称、字体大小、 每个文本段的书写方向 (水平或垂直)。它 无法识别图像中的文本。需要提供密码 受限制的 PDF 文档。
资源推荐
资源详情
资源评论
收起资源包目录
【Python源码】PDFMiner:一个用于从 PDF 文档中抽取信息的工具 (108个子文件)
pdf2html.cgi 7KB
style.css 145B
index.html 20KB
programming.html 8KB
MANIFEST.in 140B
LICENSE 1KB
Makefile 2KB
Makefile 1KB
Makefile 449B
Makefile 114B
Makefile 79B
README.md 4KB
layout.obj 12KB
cid.obj 7KB
objrel.obj 6KB
nlp2004slides.pdf 794KB
f1040nr.pdf 640KB
i1040nr.pdf 540KB
naacl06-shinyama.pdf 189KB
dmca.pdf 71KB
kampo.pdf 28KB
aes-256.pdf 13KB
aes-256-m.pdf 13KB
aes-128.pdf 13KB
aes-128-m.pdf 13KB
rc4-128.pdf 12KB
rc4-40.pdf 12KB
base.pdf 12KB
jo.pdf 3KB
simple2.pdf 1KB
simple3.pdf 1KB
simple1.pdf 849B
layout.png 3KB
cid.png 3KB
objrel.png 2KB
glyphlist.py 119KB
fontmetrics.py 61KB
rijndael.py 45KB
pdffont.py 26KB
pdfdocument.py 26KB
ccitt.py 25KB
pdfinterp.py 25KB
layout.py 21KB
psparser.py 20KB
converter.py 18KB
cmapdb.py 17KB
utils.py 9KB
dumppdf.py 9KB
pdftypes.py 8KB
latin_enc.py 8KB
pdfparser.py 5KB
pdfdevice.py 5KB
pdfpage.py 5KB
pdf2txt.py 4KB
image.py 4KB
runapp.py 3KB
lzw.py 3KB
ascii85.py 2KB
latin2ascii.py 2KB
setup.py 2KB
runlength.py 2KB
encodingdb.py 2KB
conv_afm.py 1KB
arcfour.py 1KB
prof.py 815B
pdfcolor.py 750B
conv_cmap.py 735B
conv_glyphlist.py 608B
__init__.py 98B
README 2KB
i1040nr.xml.ref 523KB
f1040nr.xml.ref 425KB
naacl06-shinyama.xml.ref 300KB
kampo.xml.ref 248KB
dmca.xml.ref 167KB
jo.xml.ref 85KB
f1040nr.html.ref 61KB
kampo.html.ref 52KB
i1040nr.html.ref 21KB
nlp2004slides.xml.ref 8KB
kampo.txt.ref 8KB
dmca.html.ref 8KB
naacl06-shinyama.html.ref 8KB
simple1.xml.ref 6KB
i1040nr.txt.ref 6KB
jo.html.ref 5KB
f1040nr.txt.ref 4KB
simple3.xml.ref 4KB
naacl06-shinyama.txt.ref 3KB
jo.txt.ref 3KB
dmca.txt.ref 2KB
simple1.html.ref 2KB
nlp2004slides.html.ref 1KB
simple3.html.ref 1KB
simple2.html.ref 823B
simple2.xml.ref 443B
nlp2004slides.txt.ref 141B
simple1.txt.ref 79B
simple3.txt.ref 60B
simple2.txt.ref 1B
共 108 条
- 1
- 2
资源评论
Unity打怪升级
- 粉丝: 1w+
- 资源: 208
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功