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
chromedriveror 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file html2pdf_chromium-0.1.0.tar.gz.
File metadata
- Download URL: html2pdf_chromium-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3c509606d9c00977d0829b3009723d3f80e102cc8ffabaacebb026b56aca7bc
|
|
| MD5 |
af00f4e40acccbf06e83299ebcdd25b8
|
|
| BLAKE2b-256 |
170d89cd55e44efc54d55027c4e03fcf63a6aaf6453f7eed83ddbad7477d8656
|
File details
Details for the file html2pdf_chromium-0.1.0-py3-none-any.whl.
File metadata
- Download URL: html2pdf_chromium-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23638290b1ab253b1a73dccf1abffd965bd1276e27850f9558ac3646b06da433
|
|
| MD5 |
4ada2e2697257dae71185fcb2799ea12
|
|
| BLAKE2b-256 |
c52b332e7f7a0201599ef032c1a6a018826ddc0bba739f3a403d03fead874214
|