---
title: "onerender"
url: https://recursiveai.org/onerender/
description: "An HTML and CSS layout and rendering engine for .NET in C#. HTML or a styled tree built in C# goes in; pixels, a tagged PDF or a display list comes out, with no browser. Razor components to PDF, rendered facts for accessibility checks, and interactive UIs. MIT or Apache-2.0."
---

# 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.

```sh
dotnet add package RecursiveAI.OneRender.Pdf
```

- [Getting started](https://recursiveai.org/onerender/docs/getting-started/)
- [Docs](https://recursiveai.org/onerender/docs/)
- [Cookbook](https://recursiveai.org/onerender/cookbook/)
- [GitHub](https://github.com/recursive-ai-oss/onerender-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneRender)

## 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 started](https://recursiveai.org/onerender/docs/getting-started/)

*Program.cs · C#*

```
using 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());
```

### 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 works](https://recursiveai.org/onerender/docs/geometry-differential/)

## The 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.Image` turns the display list into pixels: `HtmlRender.ToImage`, through oneimage. 1.0.0.
- **.Pdf**: `RecursiveAI.OneRender.Pdf` writes a tagged PDF: `HtmlPdf.ToPdf`, through onepdf. 1.0.0.
- **.Razor**: `RecursiveAI.OneRender.Razor` renders a Razor component to a PDF or an image in one call. 1.0.0.
- **.Accessibility**: `RecursiveAI.OneRender.Accessibility` produces rendered page facts in onehtml’s `RenderedFacts` shape. 1.0.0.
- **.Fonts**: `RecursiveAI.OneRender.Fonts` 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.Cjk**: `RecursiveAI.OneRender.Fonts.Cjk` adds Noto Sans CJK for Chinese, Japanese and Korean. 1.0.0.
- **.Fonts.Emoji**: `RecursiveAI.OneRender.Fonts.Emoji` adds Noto Color Emoji. 1.0.0.
- **.Fonts.Noto.**: 29 script packs, from Arabic, Devanagari and Hebrew to Thai, Tibetan and Math. [All 29 on NuGet](https://www.nuget.org/packages?q=RecursiveAI.OneRender.Fonts.Noto). 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.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/onerender-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneRender)
- [Getting started](https://recursiveai.org/onerender/docs/getting-started/)
- [All docs](https://recursiveai.org/onerender/docs/)
- [Cookbook](https://recursiveai.org/onerender/cookbook/)
- [HTML to PDF](https://recursiveai.org/onerender/cookbook/html-to-pdf/)
- [Razor to PDF](https://recursiveai.org/onerender/cookbook/razor-to-pdf/)
- [Replacing a headless browser](https://recursiveai.org/onerender/cookbook/replace-headless-browser/)
- [Game hosts](https://recursiveai.org/onerender/docs/game-hosts/)
- [Changelog](https://github.com/recursive-ai-oss/onerender-csharp/blob/v1.0.0/CHANGELOG.md)
