体操运动员:python 3中的pdf文档解析器
gymnast的Python项目详细描述
体操运动员:不是杂技演员
用python 3编写的pdf解析器(backport到2.7)。这是 旨在提供一个pythonic接口来访问(最终, 写)Adobe PDF文件。有些属性是非Python的 大写,但这是为了匹配pdf的基本结构 文档(否则会非常混乱)。
用法
importiofromgymnastimportPdfDocumentfromgymnast.rendererimportPdfBaseRendererclassPdfSimpleRenderer(PdfBaseRenderer):"""Simple renderer example that just extracts text with no processing"""def__init__(self,page):super().__init__(page)self._text=io.StringIO()def_render_text(self,text,new_state):self._text.write(self.active_font.decode_string(text))def_return(self):returnself._text.getvalue()fname='/path/to/file.pdf'pdf=PdfDocument(fname).parse()text=SimpleRenderer(pdf.Pages[-3]).render()
待办事项(无特殊顺序)
- 功能和特性
- [X]重写解析器和document类以延迟加载文档 基于外部参照表
- [X]完成基本页呈现程序
- []页面呈现
- [x]使BaseRenderer类工作
- [X]实现一个概念验证提取器,它只转储字符串
- []有点花哨,把文本块分配给行等等
- []更全面地处理页面编号
- []向PdfDocument添加一个方法,以按数字获取一个页
- []将页码的属性添加到PdfPage(两者都是 int和格式化的str根据 PdfDocument.Root.PageLabels['Nums'])
- []返回Python2.7(大约80%已完成)
- []字体
- [X]将^{TT7}$类雕刻成一个抽象的^{TT8}$ 以及PdfType1Font实现
- [X]^{TT10}$将根据 字体的子类型元素
- [X]pdfBasefont类还将具有 字形空间到文本空间的转换
- []为Type3字体添加Subcless
- [X]为TrueType字体添加Subcless
- []为复合字体添加Subcless
- [X]添加对14种标准字体的传统支持
- []字体到Unicode CMAP
- []实现剩余的StreamFilters(可能有
图像返回一个PIL.Image)
- []RunLengthDecode
- []CCITTFaxDecode
- []JBIG2Decode
- []DCTDecode
- []JPXDecode
- []Crypt
- []实现剩余的对象类型
- []ObjStm
- [X]^{TT20}$
- []Filespec
- []EmbeddedFile
- []CollectionItem/CollectionSubitem
- []XObject
- []处理文档加密
- []从图形开始(可能)
- []交互式表单(AcroForms)
- 管理
- [X]想出一个更好的名字
- []在内部记录一切都要好多好多了
- []将其整齐地打包,然后将其pypi
- []编写一些适当的文档