# onepdf-html docs, all pages (OnePdf.Html 1.0.0)
Every page of https://recursiveai.org/onepdf-html/docs/ as markdown, getting started first. Index: https://recursiveai.org/onepdf-html/llms.txt
# Getting started with OnePdf.Html
Install OnePdf.Html for .NET 10, turn an HTML page into a tagged PDF/UA-1 file, turn that PDF back into reflowing HTML and into fixed-layout HTML, read a scanned page with OCR, and do the same from the command line.
## Install
OnePdf.Html targets `net10.0`, so you need the .NET 10 SDK. The four packages share one version; this guide uses 1.0.0.
```shell
dotnet new console -o PdfHtmlStart
cd PdfHtmlStart
dotnet add package RecursiveAI.OnePdf.Html.Render --version 1.0.0
dotnet add package RecursiveAI.OnePdf.Html --version 1.0.0
dotnet add package RecursiveAI.OnePdf.Html.Ocr --version 1.0.0
```
`RecursiveAI.OnePdf.Html` converts PDF to HTML. `RecursiveAI.OnePdf.Html.Render` converts HTML to PDF; it is a separate package so that PDF to HTML users don’t get a layout engine and its fonts. `RecursiveAI.OnePdf.Html.Ocr` is only needed for scanned pages. All three are managed code with no native libraries.
## The sample files
`report.html` is a one-page library report with headings, a list, a table and a link. `scan-article.pdf` is a picture of a page with no text layer: a scan. Download both into the project folder:
```shell
curl -O https://recursiveai.org/onepdf-html/samples/report.html
curl -O https://recursiveai.org/onepdf-html/samples/scan-article.pdf
```
## HTML to PDF
`HtmlToPdf.ConvertFile` reads the HTML file, loads its CSS, images and fonts from the file’s folder, and writes a tagged PDF. `HtmlPdfProfile.PdfUA1` makes it a PDF/UA-1 file and checks it: the conversion fails if a rule is broken. PDF/UA-1 needs a title and a language, which come from the page’s `
` and ``.
```csharp
using OnePdf.Html.Render;
var options = new HtmlToPdfOptions
{
Profile = HtmlPdfProfile.PdfUA1,
Footer = HtmlHeaderFooter.PageXOfY(), // "Page 1 of 1"
};
HtmlToPdfResult result = HtmlToPdf.ConvertFile("report.html", "report.pdf", options);
Console.WriteLine($"{result.PageCount} page, title: {result.Title}");
Console.WriteLine($"{result.Diagnostics.Count} diagnostics, {new FileInfo("report.pdf").Length:N0} bytes");
```
```text
1 page, title: Harbor Street Library: October report
0 diagnostics, 23,061 bytes
```
The result is [report.pdf](https://recursiveai.org/onepdf-html/samples/report.pdf). `HtmlPdfProfile.PdfA2a` writes PDF/A-2a instead, and `PdfA2aAndUA1` writes both in one file. Page size, margins, headers and footers, and URLs as input are in the [HTML to PDF guide](https://recursiveai.org/onepdf-html/docs/html-to-pdf/).
## PDF to HTML: semantic
`PdfHtml.Convert` with no options writes semantic HTML: reflowing text in reading order. `report.pdf` is tagged, so the headings, list and table come from its tags.
```csharp
using System.Text.RegularExpressions;
using OnePdf.Html;
string html = PdfHtml.Convert("report.pdf");
string main = html[html.IndexOf("")..];
Console.WriteLine(Regex.Replace(main, "(?=<(h[1-6]|p|li|tr)[ >])", "\n")); // a line per block
```
```html
October report
Harbor Street Library, branch services
Summary
Visits rose for the third month in a row. The reading room reopened on October 6 after the roof repair, and the new self-checkout desks handled more than half of all loans.
Highlights
- Story time moved to Saturday mornings.
- Twelve volunteers joined the homework club.
- The local history archive is now open on Tuesdays.
Loans by collection
| Collection | September | October |
| Fiction | 4,210 | 4,580 |
| Nonfiction | 2,975 | 3,120 |
| Children | 3,340 | 3,615 |
The full figures are on the reports page.