onepdf-htmlCookbook
onepdf-html cookbook
Recipes
Convert a PDF to HTML in C#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#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#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#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#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#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#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#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#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#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#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#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#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#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#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#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#Set the PDF document title and author as you convert HTML in C#. Override HTML metadata with HtmlToPdfOptions without changing the visible heading.