Metadata-Version: 2.4
Name: gowkhtmltopdf
Version: 0.2.5
Summary: In-process Python bindings for the gowkhtmltopdf HTML-to-PDF engine via a ctypes-loaded c-shared library
Author: Chinmay Sawant
License: MIT
Project-URL: Homepage, https://github.com/chinmay-sawant/gowkhtmltopdf
Project-URL: Issues, https://github.com/chinmay-sawant/gowkhtmltopdf/issues
Keywords: html,pdf,wkhtmltopdf,ctypes,invoice
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: HTML
Classifier: Topic :: Printing
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# gowkhtmltopdf (Python)

In-process Python bindings for the gowkhtmltopdf HTML-to-PDF engine. The
package loads `libgowkhtmltopdf` (a Go `-buildmode=c-shared` library) with
stdlib `ctypes`; there is no subprocess and no compiled Python extension.

Requires Python 3.8+. Linux is the first-supported platform; macOS and
Windows builds follow the wheel matrix.

## Document style

Mirrors the Go `Document` API:

```python
from gowkhtmltopdf import Document, Page, Content

doc = Document(
    pages=[Page(source=Content(html=b"<html><body><h1>Invoice</h1></body></html>"))],
    page_size="A4",
)
pdf_bytes: bytes = doc.pdf()  # or doc.pdf(timeout=30)
```

## Helper style

```python
from gowkhtmltopdf import convert_html_to_pdf, PDFOptions

pdf_bytes = convert_html_to_pdf(
    html=b"<html><body><h1>Invoice #42</h1><p>Total: $19.00</p></body></html>",
    options=PDFOptions(page_size="A4", orientation="portrait"),
)

with open("invoice.pdf", "wb") as f:
    f.write(pdf_bytes)
```

Images work the same way via `ImageDocument` or
`convert_html_to_image(html, options=ImageOptions(width=1024))`.

The full build, install, security (ACL / NetworkPolicy), and ABI
stability guide lives in [documentation/python.md](../../documentation/python.md).
