Skip to main content

Python bindings for unpdf - High-performance PDF content extraction

Project description

unpdf-markdown

Python bindings for unpdf - High-performance PDF content extraction to Markdown, text, and JSON.

Installation

pip install unpdf-markdown

Quick Start

import unpdf

# Convert PDF to Markdown
markdown = unpdf.to_markdown("document.pdf")
print(markdown)

# Convert PDF to plain text
text = unpdf.to_text("document.pdf")
print(text)

# Convert PDF to JSON
json_data = unpdf.to_json("document.pdf", pretty=True)
print(json_data)

# Get document information
info = unpdf.get_info("document.pdf")
print(info)

# Get page count
pages = unpdf.get_page_count("document.pdf")
print(f"Total pages: {pages}")

# Check if file is a valid PDF
is_valid = unpdf.is_pdf("document.pdf")
print(f"Is valid PDF: {is_valid}")

API Reference

to_markdown(path: str) -> str

Convert a PDF file to Markdown format.

to_text(path: str) -> str

Convert a PDF file to plain text.

to_json(path: str, pretty: bool = False) -> str

Convert a PDF file to JSON format.

get_info(path: str) -> dict

Get document metadata (title, author, page count, etc.)

get_page_count(path: str) -> int

Get the number of pages in a PDF file.

is_pdf(path: str) -> bool

Check if a file is a valid PDF.

version() -> str

Get the version of the native library.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unpdf_markdown-0.1.8-py3-none-any.whl (5.7 MB view details)

Uploaded Python 3

File details

Details for the file unpdf_markdown-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: unpdf_markdown-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for unpdf_markdown-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d145212b8f0f0f0050b4f8fc5776d306e4f1a581dc18f618ce4b7f2dc94329f1
MD5 5d9a08e07e27c86cb614cf7ded04ac02
BLAKE2b-256 2b48d0355c4334f0ba48e237a5793fb8380d6d53ed7a4cbb821b774ec52a15c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page