Skip to content

Repository files navigation

pdf2any

python-version

PDF to DOCX, HTML, and Markdown converter — extract text, tables, and images from PDFs.

Features

  • Convert PDF to DOCX (Word documents with full formatting)
  • Convert PDF to HTML (preserves layout, tables and images)
  • Convert PDF to Markdown (clean, readable text with tables)
  • Preserve document structure: paragraphs, tables, images, text styling
  • Extract tables from PDFs
  • Multi-processing support for large documents
  • Command-line and Python API interfaces

Installation

pip install pdf2any

Quick Start

Command Line

# Convert PDF to DOCX
pdf2any convert input.pdf output.docx
# Convert PDF to HTML
pdf2any convert-html input.pdf output.html
# Convert PDF to Markdown (no page breaks)
pdf2any convert-md input.pdf output.md --nopage_break
# Convert specific pages
pdf2any convert input.pdf output.docx --pages=1,3,5

Python API

frompdf2anyimportConverter# Convert to DOCXcv=Converter("input.pdf")
cv.convert("output.docx")
# Convert to HTML (no page breaks)cv.convert_html("output.html", page_break=False)
# Convert to Markdowncv.convert_md("output.md", page_break=False)
# Extract tablestables=cv.extract_tables()
cv.close()

Key Options

OptionDescriptionDefault
--pagesSpecific pages to convert (e.g. 1,3,5)All
--nopage_breakRemove page separators in outputFalse
--remove_header_footerRemove headers and footersFalse
--multi_processingEnable parallel processingFalse

Documentation

License

MIT License — see LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages