- 浏览: 488932 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (258)
- 0-中医 (83)
- 1-工作 (4)
- 2-生活 (17)
- 3-其他 (3)
- oracle_dev (5)
- oracle_dba (35)
- ebs_gl (1)
- ebs_ap (0)
- ebs_po (0)
- ebs_hr_people (0)
- ebs_hr_payroll (0)
- java (12)
- javaScript (7)
- JSP2.0 (4)
- springMVC (3)
- spring (4)
- iBatis (5)
- Hibernate (3)
- tomcat (2)
- linux (13)
- 网络 (3)
- python (25)
- Django (11)
- z-技术 (13)
- PHPCMS (0)
最新评论
-
bo521dai:
Bravo. contains everything.
Oracle调优总结 -
yangxiutian:
固态硬盘是什么东东,既然对硬件有约束,我想推广难啊,除非若干年 ...
未来操作系统(组图) -
showzh:
...
listener.ora 、sqlnet.ora 、tnsnames.ora的关系以及手工配置举例 -
489687009:
我特别想问一下楼主,现在有了框架后,jsp2.0还有用武之地吗 ...
JSP2.0入门 -
liuzl121:
你好 我刚学java,我想请教下这个SignonControl ...
log4j详尽配置实战(for spring)
PDFMiner
Python PDF parser and analyzer
What's It?
PDFMiner is a suite of programs that help extracting and analyzing text data of PDF documents. Unlike other PDF-related tools, it allows to obtain the exact location of texts in a page, as well as other extra information such as font information or ruled lines. It includes a PDF converter that can transform PDF files into other text formats (such as HTML). It has an extensible PDF parser that can be used for other purposes instead of text analysis.
Features:
- Written entirely in Python. (version 2.4 or newer required)
- PDF-1.7 specification support. (well, almost)
- Non-ASCII languages and vertical writing scripts support.
- Various font types (Type1, TrueType, Type3, and CID) support.
- Basic encryption (RC4) support.
- PDF to HTML conversion (with a sample converter web app).
- Outline (TOC) extraction.
- Tagged contents extraction.
- Infer text running by using clustering technique.
Download:
http://www.unixuser.org/~euske/python/pdfminer/pdfminer-dist-20090711.tar.gz
(1.8Mbytes)
Discussion:
(for questions and comments, post here)
http://groups.google.com/group/pdfminer-users/
View the source:
http://code.google.com/p/pdfminerr/source/browse/trunk/pdfminer
Online Demonstration:
(pdf -> html conversion webapp)
http://pdf2html.tabesugi.net:8080/
How to Install
- Install Python 2.4 or newer.
- Download the PDFMiner source .
- Extract it.
- Run
setup.py
to install:# python setup.py install
- Do the following test:
$ pdf2txt.py samples/simple1.pdf Hello World Hello World
- Done!
For non-ASCII languages
In order to handle non-ASCII languages (e.g. Japanese),
you need to install an additional data called CMap
,
which is distributed from Adobe.
Here is how:
- Get a CMap archive file from http://www.unixuser.org/~euske/pub/CMap.tar.bz2
- Expand the archive and put the
CMap
directory under the directory wherepdfminer
is installed. (Normally this should be something like/usr/lib/python2.5/site-packages
.) For example:$ cd /usr/lib/python2.5/site-packages $ tar jxf CMap.tar.bz2
- Do the following. (this is optional, but highly recommended)
$ python -m pdfminer.cmap
How to Use
PDFMiner comes with two handy tools:
pdf2txt.py
and dumppdf.py
.
pdf2txt.py
pdf2txt.py
extracts text contents from a PDF file.
It extracts all the texts that are to be rendered programmatically,
It cannot recognize texts drawn as images that would require optical character recognition.
It also extracts the corresponding locations, font names, font sizes, writing
direction (horizontal or vertical) for each text portion.
You need to provide a password for protected PDF documents when its access is restricted.
You cannot extract any text from a PDF document which does not have extraction permission.
For non-ASCII languages, you can specify the output encoding (such as UTF-8).
Note: Not all characters in a PDF can be safely converted to Unicode.
Examples:
$ pdf2txt.py samples/naacl06-shinyama.pdf -o output.html (extract text as an HTML file whose filename is output.html) $ pdf2txt.py -c GBK samples/jo.pdf -o output.html (extract a Chinese HTML file in vertical writing, CMap is required) $ pdf2txt.py -P mypassword secret.pdf -o output.txt (extract a text from an encrypted PDF file)
Options:
-o filename
-p pageno[,pageno,...]
-c codec
-t type
-
html
: HTML format. (Default) -
text
: TEXT format. -
sgml
: SGML format. -
tag
: "Tagged PDF" format. A tagged PDF has its own contents annotated with HTML-like tags. pdf2txt tries to extract its content streams rather than inferring its text locations. Tags used here are defined in the PDF specification (See §10.7 "Tagged PDF ").
-M char_margin
-L line_margin
-W word_margin
Each value is specified not as an actual length, but as a proportion of the length to the size of each character in question. The default values are M = 1.0, L = 0.3, and W = 0.2, respectively.
→ | ← M | ||||
Q u i
|
c k
|
b r o w
|
n f o x
|
↓ | |
→ | ← W | L | |||
|
↑ |
-s scale
-m maxpages
-P password
-C CMap directory
CMAP_PATH
environment variable.
-d
dumppdf.py
dumppdf.py
dumps the internal contents of a PDF file
in pseudo-XML format. This program is primarily for debugging purpose,
but it's also possible to extract some meaningful contents
(such as images).
Examples:
$ dumppdf.py -a foo.pdf (dump all the headers and contents, except stream objects) $ dumppdf.py -T foo.pdf (dump the table of contents) $ dumppdf.py -r -i6 foo.pdf > pic.jpeg (extract a JPEG image)
Options:
-a
-i objno,objno, ...
-i
options are accepted.
-p pageno,pageno, ...
-p
options are accepted.
Note that page numbers start from one, not zero.
-r
(raw)
-b
(binary)
-t
(text)
With -r
option, the "raw" stream contents are dumped without decompression.
With -b
option, the decompressed contents are dumped as a binary blob.
With -t
option, the decompressed contents are dumped in a text format,
similar to repr()
manner. When
-r
or -b
option is given,
no stream header is displayed for the ease of saving it to a file.
-T
-P password
-d
Changes
- 2009/07/11: Improvement in layout analysis. Thanks to Lubos Pintes.
- 2009/05/17: Bugfixes, massive code restructuring, and simple graphic element support added. setup.py is supported.
- 2009/03/30: Text output mode added.
- 2009/03/25: Encoding problems fixed. Word splitting option added.
- 2009/02/28: Robust handling of corrupted PDFs. Thanks to Troy Bollinger.
- 2009/02/01: Various bugfixes. Thanks to Hiroshi Manabe.
- 2009/01/17: Handling a trailer correctly that contains both /XrefStm and /Prev entries.
- 2009/01/10: Handling Type3 font metrics correctly.
- 2008/12/28: Better handling of word spacing. Thanks to Christian Nentwich.
- 2008/09/06: A sample pdf2html webapp added.
- 2008/08/30: ASCII85 encoding filter support.
- 2008/07/27: Tagged contents extraction support.
- 2008/07/10: Outline (TOC) extraction support.
- 2008/06/29: HTML output added. Reorganized the directory structure.
- 2008/04/29: Bugfix for Win32. Thanks to Chris Clark.
- 2008/04/27: Basic encryption and LZW decoding support added.
- 2008/01/07: Several bugfixes. Thanks to Nick Fabry for his contribution.
- 2007/12/31: Initial release.
- 2004/12/24: Start writing the code out of boredom...
Related Projects
Terms and Conditions
Copyright (c) 2004-2009 Yusuke Shinyama <yusuke at cs dot nyu dot edu>
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.
Yusuke Shinyama
发表评论
-
Django之Apache/mod_python安装及HelloWorld
2009-11-12 11:31 1817from: http://hideto.iteye.com/b ... -
一个python写的简单的代理服务器
2009-08-02 22:14 4550from: http://dream-people.iteye ... -
Python模块包中__init__.py文件的作用
2009-07-29 17:03 1277from:http://www.iteye.com/topic ... -
Google App Engine 开发人员指南
2009-07-27 13:31 932http://code.google.com/intl/zh- ... -
正则表达式
2009-07-27 12:28 907from: http://jamesblog.iteye.co ... -
Chinese Python User Group 中文Python用户组
2009-07-24 15:17 1138http://groups.google.com/group/ ... -
开心网查看朋友果实的小程序
2009-07-23 17:16 1413#!/usr/bin/env python # -* ... -
html 2 txt (完善中)
2009-07-23 17:01 1038import re filename=raw_input( ... -
英汉字典(有道)
2009-07-23 16:59 1236# fileName : dict.py import re ... -
Python学习计划
2009-07-22 10:37 3097from:http://jythoner.iteye.com/ ... -
python 资料共享(from javaeye )
2009-07-22 10:33 1012http://onlypython.group.iteye.c ... -
Python中的全局变量
2009-07-21 14:34 1163全局变量不符合参数传递的精神,所以,平时我很少使用,除非定义常 ... -
python教程:几行代码搞定python 设计模式
2009-07-21 13:55 1357# #!/usr/bin/env python # # ... -
python教程:异常处理
2009-07-21 13:52 1163#例子1 1. #coding:utf-8 2. ... -
python 搜索 PDF文件 内容
2009-07-20 09:44 7171我想做个小东东,需要读取pdf文件的文本内容,然后搜索某个关键 ... -
数据库 API 参考
2009-07-02 09:19 822http://www.woodpecker.org.cn/ob ... -
python编程八荣八耻
2009-07-01 16:20 1041python编程八荣八耻 以动手实践为荣, 以只看不练为耻; ... -
python中cx_Oracle模块安装遇到的问题与解决方法
2009-06-26 09:59 7864--============================= ... -
python教程:分支、循环
2009-06-23 15:36 3452讲程序设计,不得不讲到顺序、分支、循环。 顺序就是从上到下运行 ... -
python 实践
2009-06-18 15:58 926http://www.iteye.com/topic/1011 ...
相关推荐
PDFMiner3K安装包 tar.gz PDFMiner3K安装包 tar.gzPDFMiner3K安装包 tar.gzPDFMiner3K安装包 tar.gz PDFMiner3K安装包 tar.gz PDFMiner3K安装包 tar.gz PDFMiner3K安装包 tar.gz PDFMiner3K安装包 tar.gz
用户在线、本地解析PDF的pdfminer3k官网包。使用方式见本博客:http://blog.csdn.net/y515789/article/details/77446835 --就着注释看代码,是一件美差。
PDFMiner 是一个 Python 的 PDF 解析器,可以从 PDF 文档中提取信息。与其他 PDF 相关的工具不同,它侧重的是获取和分析文本数据。PDFMiner 允许获取某一页中文本的准确位置和一些诸如字体、行数的信息。它包括一个 ...
资源来自pypi官网。 资源全名:pdfminer-20100213.tar.gz
python3的pdfminer.six,可以处理PDF,提取PDF中的内容,含pdf2txt.py等
pdfminer3-2018.12.3.0.tar, pdf
pdfminer是python下一款处理PDF文件的组件,用于提取pdf中的文本信息。自动化办公必备。
编译好的python3可以使用的pdfminer,可以处理中文,直接setup安装
pdfminer.six 我们了解PDF Pdfminer.six是原始PDFMiner的社区维护的分支。 它是从PDF文档中提取信息的工具。 它着重于获取和分析文本数据。 Pdfminer.six直接从PDF的源代码中提取页面中的文本。 它也可以用来获取...
1、安装 pdfminer3k 通过pip安装: pip install pdfminer3k 下载安装:在网页 https://pypi.org/project/pdfminer3k/1.3.1/#files 进行下载,解压。然后cmd命令进入到当前文件夹: 可以直接在资源管理器的路径栏直接...
文件包含安装包与安装说明,从网上搜集的资源整理下来分享给大家。通过此库可以进行PDF的爬虫操作,亲测可用
主要介绍了python 提取pdf文字代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
pdfminer官方文档 python 分析pdf文件并可以转成txt文件 https://blog.csdn.net/smilife_/article/details/89480642
近期在做爬虫时有时会遇到网站只提供pdf的情况,这样就不能使用scrapy直接抓取页面内容了,只能通过解析PDF的方式处理,目前的解决方案大致只有pyPDF和PDFMiner。因为据说PDFMiner更适合文本的解析,而我需要解析的...
pdfminer pdf-txt转换模块
最近要做个从 pdf 文件中抽取文本内容的工具,大概查了一下 python 里可以使用 pdfminer 来实现。下面就看看怎样使用吧。 PDFMiner是一个可以从PDF文档中提取信息的工具。与其他PDF相关的工具不同,它注重的完全是...
PDFMiner PDFMiner是用于PDF文档的文本提取工具。 警告:截至2020年,尚未积极维护PDFMiner 。 该代码仍然有效,但是该项目处于Hibernate状态。 对于活动项目,请查看其分支 。特征: 纯Python(3.6或更高版本)。 ...
pdfplumber以pdfminer为基础,但是pdfminer的操作过于复杂且代码过于冗长。 注:pdfminer在python3.0以上为pdfminer3k pdfminer3k 实现解析的代码: from pdfminer.pdfparser import PDFParser from pdfminer....
PDFMiner:一个用于从PDF文档中抽取信息的工具