Skip to main content

Convert HTML to PDF using Chromium browsers with zero Python dependencies

Project description

html2pdf_chromium

Convert HTML files or HTML strings to PDF using Chromium-based browsers(like Chrome or Edge) in headless mode without dependencies such as chromedriver.

✨ Features

  • 📄 Convert HTML files or strings to PDF
  • 🧠 Uses headless Chrome or Edge
  • 🧰 No additional Python dependencies — uses only the standard library
  • Does not require chromedriver or Selenium

📦 Installation

pip install html2pdf_chromium

Usage

PDF from HTML File

from html2pdf_chromium import Converter

converter = Converter()  # Uses Chrome by default
converter.convert_file("example.html", "output.pdf")

PDF from HTML String

from html2pdf_chromium import Converter

converter = Converter()  # Uses Chrome by default
content = """
<html>
  <body>
    <h1>Hello PDF!</h1>
    <p>This was generated from an HTML string.</p>
  </body>
</html>
"""
converter.convert_string(content, "output.pdf")

Selecting browser (used to detect executables in common paths)

from html2pdf_chromium import Converter

converter = Converter(browser="edge")
converter.convert_file("example.html", "output.pdf")

Using a custom path for other Chromium based browsers

from html2pdf_chromium import Converter

converter = Converter(executable_path="path_to_executable/chromium.exe") 
converter.convert_file("example.html", "output.pdf")

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

html2pdf_chromium-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

html2pdf_chromium-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file html2pdf_chromium-0.1.2.tar.gz.

File metadata

  • Download URL: html2pdf_chromium-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for html2pdf_chromium-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4cf80addafa53fdac5b098c62b3ed6552497d3b94c54268a4fe2e8f8293de85e
MD5 9ac0bd135f513819c380c22d58efbda3
BLAKE2b-256 3277c4a93b8fba1255c51074731af1b22d00626420ee13f3ae0ecb9b7312d4b5

See more details on using hashes here.

File details

Details for the file html2pdf_chromium-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for html2pdf_chromium-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d444549f45a8d5856927195683abb36345c6b40ad003abf7c47d0954f414e38
MD5 1279cd543f02c6233cecb9d09089c557
BLAKE2b-256 52c1ad1d9f836b16fee0ebe75ac4374500696e37163ff9fd5da3695325d88bd6

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