onerender
An HTML and CSS rendering engine for .NET, written in C# from the specifications. HTML in, pixels or a tagged PDF out, with no browser, no network and no clock.
A quick look
One call each for a PDF and a PNG. The PDF is tagged from the HTML, and the text is set in bundled fonts, so the output is the same on every machine.
Getting startedusing OneRender.Image; using OneRender.Pdf; string html = "<h1>Invoice INV-1042</h1><p>Rendered without a browser.</p>"; File.WriteAllBytes("invoice.pdf", HtmlPdf.ToPdf(html)); var options = new HtmlRenderOptions { Width = 600, Height = 200 }; RgbaImage image = HtmlRender.ToImage(html, options); File.WriteAllBytes("invoice.png", image.ToPng());
What it does
Lays out real CSS
Block and inline layout, floats, positioning, flexbox, grid with subgrid, tables, multi-column, and bidirectional text shaped by onefont.
Tagged PDFs from HTML
Headings, lists, tables and alt text become the PDF’s structure, with PDF/UA-1 and PDF/A-2a one option away. @page, margin boxes and page numbers work.
Razor in one call
Render a Razor component to a PDF or an image inside ASP.NET Core, with style sheets, images and fonts served from wwwroot.
Interactive UIs and games
Hit testing, DOM-standard events, focus, scrolling, form controls with text editing, and CSS animations on your own clock. Steady frames allocate nothing.
Accessibility checks without a browser
Lays a page out and hands onehtml’s checker the rendered facts it needs for contrast and target size.
Nothing runs that you didn’t pass in
No JavaScript, no network, no processes and no unsafe code. Your code supplies every style sheet, image and font, and limits are checked before the work they guard.
Compared with Chrome, element by element
Layout is compared with Chrome for Testing 156 on the same font files. On six document templates, 99.967% of the geometry is within tolerance at both 1280 × 800 and 390 × 844. Web Platform Tests gate each CSS module, and tagged PDFs are validated against PDF/UA-1 with veraPDF.
How the comparison worksThe packages
- RecursiveAI.OneRender
The engine: styles, layout, paged media, paint to a display list, hit testing, events, focus, forms and animations. Depends on onehtml and onefont. 1.0.0.
- .Image
RecursiveAI.OneRender.turns the display list into pixels:Image HtmlRender.ToImage, through oneimage. 1.0.0. - .Pdf
RecursiveAI.OneRender.writes a tagged PDF:Pdf HtmlPdf.ToPdf, through onepdf. 1.0.0. - .Razor
RecursiveAI.OneRender.renders a Razor component to a PDF or an image in one call. 1.0.0.Razor - .Accessibility
RecursiveAI.OneRender.produces rendered page facts in onehtml’sAccessibility RenderedFactsshape. 1.0.0. - .Fonts
RecursiveAI.OneRender.bundles Liberation Sans, Serif and Mono, Carlito and Caladea, which also answer to Arial, Times New Roman, Courier New, Calibri and Cambria. 1.0.0.Fonts - .Fonts.Cjk
RecursiveAI.OneRender.adds Noto Sans CJK for Chinese, Japanese and Korean. 1.0.0.Fonts. Cjk - .Fonts.Emoji
RecursiveAI.OneRender.adds Noto Color Emoji. 1.0.0.Fonts. Emoji - .Fonts.Noto.*
29 script packs, from Arabic, Devanagari and Hebrew to Thai, Tibetan and Math. All 29 on NuGet. 1.0.0.
- .NET
.NET 10. NativeAOT, trimming and WebAssembly are supported. Every package shares one version. MIT or Apache-2.0; the font packages add the SIL Open Font License.