---
title: "onepdf-html cookbook"
url: https://recursiveai.org/onepdf-html/cookbook/
description: "17 OnePdf.Html recipes, each with complete code."
version: "1.0.0"
---

# onepdf-html cookbook

## Recipes

- [Convert a PDF to HTML in C#](https://recursiveai.org/onepdf-html/cookbook/convert-pdf-to-html/index.md): Convert PDF to HTML in C# with OnePdf.Html. Write a browser-ready file with headings and paragraphs that reflow, or get the HTML as a string.
- [Convert PDF to HTML and keep the layout in C#](https://recursiveai.org/onepdf-html/cookbook/convert-pdf-to-html-keeping-layout/index.md): Convert PDF to HTML in C# while keeping the page layout. Use OnePdf.Html’s fixed-layout mode to preserve page size, text placement, and graphics.
- [Convert a scanned PDF to HTML with OCR in C#](https://recursiveai.org/onepdf-html/cookbook/convert-scanned-pdf-to-html-with-ocr/index.md): Convert a scanned PDF to searchable HTML in C# with local OCR. See the recognized text and use automatic OCR for PDFs with a mix of scans and text.
- [Extract tables from a PDF as HTML in C#](https://recursiveai.org/onepdf-html/cookbook/extract-pdf-tables-as-html/index.md): Extract tables from a PDF as HTML in C# with OnePdf.Html. Keep rows and cells as HTML elements instead of turning the table into a picture.
- [Convert selected PDF pages to HTML in C#](https://recursiveai.org/onepdf-html/cookbook/convert-selected-pdf-pages-to-html/index.md): Convert selected PDF pages to HTML in C# without splitting the file. Set a page range or a list of page indices with OnePdf.Html.
- [Convert a password-protected PDF to HTML in C#](https://recursiveai.org/onepdf-html/cookbook/convert-password-protected-pdf-to-html/index.md): Convert a password-protected PDF to HTML in C# with an authorized password. Handle a missing or incorrect password with PdfPasswordException.
- [Lazy-render PDF pages in an HTML export in C#](https://recursiveai.org/onepdf-html/cookbook/lazy-render-pages-in-pdf-to-html-output/index.md): Defer rendering offscreen pages in a fixed-layout PDF-to-HTML export in C#. OnePdf.Html uses CSS content-visibility without JavaScript.
- [Set raster fallback DPI for PDF-to-HTML export in C#](https://recursiveai.org/onepdf-html/cookbook/set-raster-resolution-in-pdf-to-html-output/index.md): Set the DPI of PDF-to-HTML raster fallback images in C#. Change picture resolution without changing the fixed-layout page size.
- [Convert a PDF to HTML, one file per page, in C#](https://recursiveai.org/onepdf-html/cookbook/convert-pdf-to-html-page-per-file/index.md): Convert a PDF to HTML in C#, with one HTML file per PDF page and an index linking them. Export every page or select a range with OnePdf.Html.

## HTML to PDF

- [Convert HTML to PDF/UA in C#](https://recursiveai.org/onepdf-html/cookbook/convert-html-to-accessible-pdf-ua/index.md): Convert an HTML file to a tagged PDF with the PDF/UA-1 profile in C#. See how the title, document language, headings, and lists carry into the PDF.
- [Convert a URL to PDF in C#](https://recursiveai.org/onepdf-html/cookbook/convert-url-to-pdf/index.md): Save a web page as a PDF from C# using its HTTP or HTTPS URL. This .NET example fetches HTML and print resources without running JavaScript.
- [HTML to PDF with headers, footers, and page numbers in C#](https://recursiveai.org/onepdf-html/cookbook/add-page-numbers-header-footer-html-to-pdf/index.md): Convert HTML to PDF in C# with a repeating header and a Page X of Y footer. See how to set margins and move the number to a different position.
- [Convert HTML to PDF/A-2a in C#](https://recursiveai.org/onepdf-html/cookbook/convert-html-to-pdfa/index.md): Convert HTML to PDF/A-2a in C# with OnePdf.Html. Set the archival profile, keep the document structure, and run a .NET 10 example with sample HTML.
- [Add PDF bookmarks from HTML headings in C#](https://recursiveai.org/onepdf-html/cookbook/add-bookmarks-from-html-headings-to-pdf/index.md): Turn HTML headings into clickable PDF bookmarks in C#. Keep only the heading levels you want in the PDF outline, with a runnable .NET 10 example.
- [Batch convert a folder of HTML files to PDF in C#](https://recursiveai.org/onepdf-html/cookbook/convert-folder-of-html-files-to-pdf/index.md): Convert every .html file in a folder to a separate PDF in C#. Write the files to an output folder, report failures, and include subfolders if needed.
- [HTML to PDF: set paper size and margins in C#](https://recursiveai.org/onepdf-html/cookbook/set-page-size-and-margins-for-html-to-pdf/index.md): Convert HTML to PDF in C# on Letter, A4, or custom paper. Set the margins in inches or millimeters and override the page size in your HTML.
- [HTML to PDF: set title and author in C#](https://recursiveai.org/onepdf-html/cookbook/set-pdf-metadata-when-converting-html/index.md): Set the PDF document title and author as you convert HTML in C#. Override HTML metadata with HtmlToPdfOptions without changing the visible heading.
