Metadata-Version: 2.4
Name: weblitz
Version: 2.0.0rc2
Summary: HTML, URLs, RDLC reports and Markdown to PDF, Word, Excel and PowerPoint, as Chrome prints them, with no browser.
Author: SSRS2
License: Proprietary: see LICENSE.md
Project-URL: Homepage, https://weblitzpdf.com
Keywords: pdf,html-to-pdf,rdlc,report,playwright,print,docx,xlsx,pptx
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Printing
Classifier: Topic :: Office/Business
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# weblitz

HTML, URLs, RDLC reports and Markdown to PDF, Word, Excel and PowerPoint, as Chrome prints them, with no browser.

```python
import weblitz

weblitz.render_html("<h1>Hello</h1>", format="A4", margin={"top": "2cm"}).save("hello.pdf")
weblitz.render_url("https://example.com", print_background=True, path="example.pdf")
weblitz.render_html(page, output="xlsx").save("page.xlsx")
weblitz.render_url("https://example.com", output="png", viewport={"width": 1280, "device_scale_factor": 2}, path="example.png")
```

The options of `render_html` and `render_url` are Playwright's `page.pdf()` options by their Python names. Every call
answers a `Result` (`file`, `content_type`, `extension`, `pages`, `notes`, `trial`) or raises `WeblitzError`, whose
`code` says why.

`output="png"` (or `"jpeg"`, `"webp"`, `"tiff"`) draws the page instead of printing it, with Playwright's screenshot
names: by default the whole page as a screen shows it, in one image, laid out in an 800 by 600 window in screen media;
`capture="viewport"` (or `full_page=False`) the window alone; `capture="pages"` each printed page as the PDF prints it
(paper, margins, `page_ranges`), answered as a ZIP of `page-1.png`, `page-2.png`... (a TIFF holds every page in one
file). `viewport={"width": ..., "height": ..., "device_scale_factor": 2}` sets the window and the image's pixels per
CSS pixel, `quality` a JPEG's or WebP's (0 to 100).

Calls go to a pool of worker processes kept warm, started on first use. `weblitz.configure(...)` sets its options
(`workers`, `concurrency`, `license`, `timeout` in milliseconds...); `weblitz.Engine` is a pool of your own and
`weblitz.AsyncEngine` the same for asyncio (cancelling the awaiting task cancels the render).

The wheel's worker is not compiled ahead of time, which keeps the wheel within PyPI's size limit: a new worker's first
render takes longer than with the npm package, and the renders after it are as fast. Render from one long-running
process rather than a process per document, and call `weblitz.info()` at start-up when the first request should not
wait for a worker to start.

Without a licence key (`license=` or the environment's `SSRS2_LICENSE`) PDF and image pages carry a trial watermark.

Wheels exist for Linux with glibc (x64, arm64) and macOS on Apple silicon; Alpine and other musl systems are not
supported yet.
