Recursive AI
onerenderCookbook

onerender cookbook

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

Recipes

Convert HTML to PDFTurn 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, and keep links working.Convert HTML to PNGRender 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 times the pixel density.Render a Razor component to PDFRender a Razor component to a tagged PDF from an ASP.NET Core endpoint in one call, with its style sheet served from wwwroot, using RecursiveAI.OneRender.Razor.Fonts: defaults, CJK, emoji and Noto script packsFind 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 font with @font-face.Headers, footers and page breaksControl 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 page breaks, and a landscape page for one section.Accessible PDF: PDF/UA-1 and PDF/A-2aWrite 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#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 state and redraw only what changed.Hit testing and events for a UIUse 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, and repaint only what changed, on your own clock.Check accessibility with rendered factsLay 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 size, get a verdict without a browser.Replace a headless browser for renderingMove HTML-to-PDF and screenshot jobs off Puppeteer, Playwright or wkhtmltopdf onto OneRender: no Chromium download, no browser process, and the same output on every machine. Here is each common call and what replaces it.