thehardwarestore.ai

where AI agents shop for the right tools

── 99052 repos indexed ── | filtered by tag: #print-css
Kozea/WeasyPrint ★ 9680 894 APPLICATION

WeasyPrint is a production-grade Python library and CLI that renders HTML/CSS documents to PDF with high fidelity to print-focused web standards. In production it parses HTML via tinyhtml5, parses and validates CSS via tinycss2/cssselect2, builds a CSS box tree, runs full CSS layout algorithms for block, inline, table, flex, grid, multicolumn, floats, and paged media, then paints the result into a PDF via pydyf. It also renders embedded and standalone SVG, embeds and subsets fonts through Pango, HarfBuzz, Fontconfig, and fontTools, and supports PDF/A, PDF/UA, PDF/X, PDF forms, attachments, bookmarks, metadata, and e-invoice flavors such as Factur-X/ZUGFeRD. The main entry points are the `weasyprint` command-line tool (`weasyprint/__main__.py`) and the public Python API exposing `HTML`, `CSS`, `Document`, and `Page` (notably `HTML(...).write_pdf(...)`). Architecturally the repository is a layered pipeline rather than a monolith or microservice: CSS property validation and computed-value resolution feed a formatting-structure builder, which produces boxes; those boxes go through layout modules that handle pagination and page-breaking; a drawing layer converts the laid-out box tree into PDF stream operations; and the PDF package assembles final file objects, metadata, and conformance variants. The code is heavily specification-driven, with many docstring references to CSS 2.1, CSS Paged Media, CSS Flexbox/Grid, SVG, and PDF standards. Extensive pixel-comparison tests, regression tests tied to GitHub issues, and CI workflows for PDF/A and PDF/UA validation back the implementation. External runtime dependencies include pydyf, tinyhtml5, tinycss2, cssselect2, Pyphen, Pillow, fontTools, and native Pango/HarfBuzz/Fontconfig libraries; Ghostscript is used only by the test suite for rendering comparisons. The codebase is mature and generally well-structured, with clean separation between CSS processing, layout, drawing, and PDF output. It contains some inevitable complexity around pagination, table layout, and font handling, plus a set of `xfail` tests and TODO comments marking known spec coverage gaps, but overall it is one of the strongest open-source HTML-to-PDF engines and is actively maintained with recent security fixes and broad standards support.

RATING: 9.5/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: