Package: depdf
DePDFAn ultimate pdf file disintegration tool. DePDF is designed to extract tables and paragraphs into structured markup language [eg. html] from embedding pdf pages. You can also use it to convert pdf page or pdf to html.Built on top ofpdfplumberCheckout automatically generateddocumentationif you wish.Table of Contents[toc]Installationpip install depdfExamplefromdepdfimportDePDFfromdepdfimportDePage# generalwithDePDF.load('test/test.pdf')aspdfpdf_html=pdf.to_htmlprint(pdf_html)# with dedicated configurationsc=Config(debug_flag=True,verbose_flag=True,add_line_flag=True)pdf=DePDF.load('test/test.pdf',config=c)page_index=23# start from zeropage=pdf_file.pages[page_index]page_soup=page.soupprint(page_soup.text)APIsfunctionsusageextract_page_paragraphsextract paragraphs from specific pageextract_page_tablesextract tables from specific pageconvert_pdf_to_htmlconvert the entire pdf to htmlconvert_page_to_htmlconvert specific page to htmlIn-DepthIn-page elementsParagraphTextSpanTableCellImageCommon propertiesproperty & methodexplanationhtmlconverted html stringsoupconverted beautiful soupbboxbounding box regionsave_htmlwrite html tag to local fileDePDF HTML structure<divclass="{pdf_class}">%for<!--page-{pid}--><divid="page-{pid}"class="{page_class}">%for {in_page_elements} endfor%</div>endfor%</div>DePage HTML element structureParagraph<p>{text-content}<span>{span-content}</span>...</p>Table<table><tr><td>{cell_0_0}</td><td>{cell_0_1}</td>...</tr><trcolspan=2><td>{merged_cell_1_0}</td>...</tr>...</table>Image<img src="temp_depdf/$prefix.png"></img>Configuration encyclopediaPDF 解析keyworddetaildefaultlogo_flag是否分析不同页面共有的水印信息Trueheader_footer_flag是否分析不同页面共有的页眉页脚信息Truetemp_dir_prefix是否分析不同页面共有的页眉页脚信息temp_depdfunique_prefix生成临时文件图片的文件名称（一般会自动生成）页面解析keyworddetaildefaulttable_flag是否解析表格Trueparagraph_flag是否解析段落Trueimage_flag是否解析图片Trueresolutiondebug 模式下生成页面预览图的分辨率300main_frame_tolerance识别页面内主要文字区域的阈值x_tolerance识别页面内文本行的横向阈值y_tolerance识别页面内文本行的纵向阈值page_num_top_fraction识别页面内页码信息上边界距离和页面的高度比例page_num_left_fraction识别页面内页码信息page_num_right_fraction识别页面内页码信息页面分栏识别keyworddetaildefaultmultiple_columns_flag是否识别多栏页面Truemax_columns识别多栏页面栏数上限3column_region_half_width识别多栏页面栏分界宽度min_column_region_objects识别多栏页面栏分界内的对象数目上限字符提取keyworddetaildefaultchar_overlap_size判断字符是否重叠的阈值default_char_size默认的字符大小char_size_upper探测到字符大小的上限char_size_lower探测到字符大小的下限表格提取keyworddetaildefaultdotted_line_flag是否分析页面内的虚线curved_line_flag是否分析页面内的曲线snap_flag是否合并表格线段add_line_flag是否为表格增加横竖线min_double_line_tolerance判断线段是否为临近双线的距离下限max_double_line_tolerance判断线段是否为临近双线的距离上限vertical_double_line_tolerance判断线段是否为垂直临近双线的距离上限table_cell_merge_tolerance合并单元格的宽度差别容错值skip_empty_table是否忽略空白表格add_vertical_lines_flag是否增加竖线add_horizontal_lines_flag是否增加横线add_horizontal_line_tolerance增加横线的阈值图片提取keyworddetaildefaultmin_image_size识别图片的边长最小像素值80image_resolution提取图片的分辨率300页眉页脚识别keyworddetaildefaultdefault_head_tail_page_offset_percent页眉页脚的错位比例日志输出keyworddetaildefaultlog_level日志的级别WARNINGverbose_flag是否输出运行中间过程信息Falsedebug_flag是否打开调试（生成解析对象的边界信息）False生成的网页标签keyworddetaildefaultspan_class生成 HTML 的 span 节点的 classpdf-spanparagraph_class生成 HTML 的 p 节点的 classpdf-paragraphtable_class生成 HTML 的 table 节点的 classpdf-tablepdf_class生成 HTML 的最外层 pdf div 节点的 classpdf-contentimage_class生成 HTML 的 img 节点的 classpdf-imagepage_class生成 HTML 的 page div 的 classpdf-pagemini_page_class生成 HTML 的 mini-page div 的 classpdf-mini-pageUpdate log2020-03-18add support for multiple-column PDFs2020-03-12initial depdf releaseAppendixtodoadd support for multiple-column pdf pagebetter table structure recognitionrecognize embedded objects inside page elementsProject overview.
├──depdf
│├──components
││├──image.py
││├──paragraph.py
││├──span.py
││├──table.py
││└──text.py
│├──api.py
│├──base.py
│├──config.py
│├──error.py
│├──log.py
│├──page.py
│├──page_tools.py
│├──pdf.py
│├──pdf_tools.py
│├──settings.py
│├──utils.py
│└──version.py
├──test│├──test.html
│├──test.pdf
│├──test.py
│└──test_mc.pdf
├──LICENSE
├──README.md
├──annotations.jpg
└──pyproject.toml4directories,33filesDePage element denotationsUseful element properties within page