Skip to main content

Python SDK for the HTPDF API — generate PDFs, screenshots, and more

Project description

HTPDF Python SDK

Generate PDFs, screenshots, and hosted documents via the HTPDF API.

Install

pip install htpdf

Quick Start

from htpdf import HTPDFClient

client = HTPDFClient("htpdf_live_...")

# HTML to PDF
result = client.html_to_pdf("<h1>Hello World</h1>")
print(result["pdf_id"], result["url"])

# Download
pdf_bytes = client.download(result["pdf_id"])
with open("output.pdf", "wb") as f:
    f.write(pdf_bytes)

# URL to PDF
result = client.url_to_pdf("https://example.com")

# Async PDF (Pro+)
job = client.async_pdf("html", html="<h1>Async</h1>")
completed = client.wait_for_async_job(job["job_id"])

# Document Hosting (Pro+)
doc = client.create_hosted_document(result["pdf_id"], expires_in_hours=24)
print(doc["url"])  # /d/abc12345

License

MIT

Project details


Download files

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

Source Distribution

htpdf-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

htpdf-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file htpdf-1.0.0.tar.gz.

File metadata

  • Download URL: htpdf-1.0.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for htpdf-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f288942576a6ab060f2ab8ffbd1cd777479c7b747a876bcb5ff6354bd78bd9ef
MD5 142afa6008a70f0481d71ede33d96532
BLAKE2b-256 d2d5457acb50a8172eadb1e60d4c6512028af418c733403f2b35ac86d9aa3591

See more details on using hashes here.

File details

Details for the file htpdf-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: htpdf-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for htpdf-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a71e527ac30083b33523eff421da9cbd34a3ca1b2e49fe4d53ace7bd0adda2c6
MD5 358314075d8383cb8f4bc1aa5b66b081
BLAKE2b-256 12332b9cf7af7259edf7e93a156337c4ec898bbe39faad7c8505eee23288daa1

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