---
title: "onerender cookbook"
url: https://recursiveai.org/onerender/cookbook/
description: "Short recipes for common OneRender tasks, each with complete code you can copy."
version: "1.0.0"
---

# onerender cookbook

Short recipes for common OneRender tasks, each with complete code you can copy.

## Recipes

- [Convert HTML to PDF](https://recursiveai.org/onerender/cookbook/html-to-pdf/index.md): Turn an HTML page into a tagged PDF in C# with OneRender, with no browser: set the page size and margins, write metadata, stream the file to a response…
- [Convert HTML to PNG](https://recursiveai.org/onerender/cookbook/html-to-png/index.md): Render HTML and CSS to a PNG in C# with OneRender: a 1200 by 630 social card with a gradient and a logo, and a badge on a transparent background at three…
- [Render a Razor component to PDF](https://recursiveai.org/onerender/cookbook/razor-to-pdf/index.md): Render a Razor component to a tagged PDF from an ASP.NET Core endpoint in one call, with its style sheet served from wwwroot, using…
- [Fonts: defaults, CJK, emoji and Noto script packs](https://recursiveai.org/onerender/cookbook/fonts/index.md): Find out which characters the bundled fonts can’t draw, add the package that covers them (CJK, emoji or one of 29 Noto script packs), and load your own…
- [Headers, footers and page breaks](https://recursiveai.org/onerender/cookbook/paged-media/index.md): Control a PDF’s pages from CSS with OneRender: page size and margins with @page, a running header and “Page 1 of 5” footer in the margin boxes, forced…
- [Accessible PDF: PDF/UA-1 and PDF/A-2a](https://recursiveai.org/onerender/cookbook/accessible-pdf/index.md): Write HTML to a PDF that declares PDF/UA-1, PDF/A-2a or both with OneRender, and see how a document that breaks a rule is refused with the reasons.
- [Build a styled tree in C#](https://recursiveai.org/onerender/cookbook/styled-tree/index.md): Lay out and draw a UI with no HTML at all: build the element tree in C# with CSS property values, render it with LivePage, then change text and hover…
- [Hit testing and events for a UI](https://recursiveai.org/onerender/cookbook/hit-testing-events/index.md): Use an HTML page as an interactive UI with OneRender: find the element under the pointer, listen for clicks that bubble, get :hover and keyboard focus…
- [Check accessibility with rendered facts](https://recursiveai.org/onerender/cookbook/accessibility-facts/index.md): Lay a page out with OneRender and hand the layout to OneHtml’s accessibility checker, so rules that need rendering, such as color contrast and target…
- [Replace a headless browser for rendering](https://recursiveai.org/onerender/cookbook/replace-headless-browser/index.md): Move HTML-to-PDF and screenshot jobs off Puppeteer, Playwright or wkhtmltopdf onto OneRender: no Chromium download, no browser process, and the same…
