Convert any web page or any raw HTML string to PDF.
- Convert any web page to PDF
- Convert any raw HTML string to PDF
- Multiple web pages into one PDF
A fast, accurate HTML to PDF converter for any .NET application — turn a live web page or a raw HTML string into a pixel-faithful PDF with full HTML5/CSS3/JavaScript, headers, footers and page breaks. It is the conversion engine of the commercial SelectPdf library: a perpetual per-developer license, royalty-free OEM options, and a free, no-limit trial — every page watermarked — to evaluate it before buying.
No third-party dependencies. Runs inside your .NET app on Windows.
Everything the HTML to PDF conversion exposes — the full option surface, controlled from a few lines of C# or VB.NET.
Convert any web page or any raw HTML string to PDF.
Control the geometry of every page.
Custom HTML running chrome on every page.
Decide exactly where pages split.
Renders the page the way a browser would.
Render dynamic, script-driven pages.
Reach pages behind a login or a proxy.
Convert only what you need.
Keep the document navigable.
Set what the reader sees and stores.
Protect the generated document.
Standards-compliant, archival output.
Instantiate HtmlToPdf, call ConvertUrl or ConvertHtmlString, save the document. That is the whole API.
using SelectPdf;
// instantiate the HTML to PDF converter
HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
converter.Options.WebPageWidth = 1024;
// convert a live URL to a PDF document
PdfDocument doc = converter.ConvertUrl("https://www.example.com");
// save and close
doc.Save("output.pdf");
doc.Close();
Imports SelectPdf
Module Program
Sub Main()
' instantiate the HTML to PDF converter
Dim converter As New HtmlToPdf()
converter.Options.PdfPageSize = PdfPageSize.A4
converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait
converter.Options.WebPageWidth = 1024
' convert a live URL to a PDF document
Dim doc As PdfDocument = converter.ConvertUrl("https://www.example.com")
doc.Save("output.pdf")
doc.Close()
End Sub
End Module
using SelectPdf;
string html = "<h1>Invoice 4821</h1><p>Thanks for your order.</p>";
HtmlToPdf converter = new HtmlToPdf();
converter.Options.MarginTop = 20;
converter.Options.MarginBottom = 20;
// convert a raw HTML string to a PDF document
PdfDocument doc = converter.ConvertHtmlString(html);
doc.Save("invoice.pdf");
doc.Close();
Imports SelectPdf
Module Program
Sub Main()
Dim html As String = "<h1>Invoice 4821</h1><p>Thanks for your order.</p>"
Dim converter As New HtmlToPdf()
converter.Options.MarginTop = 20
converter.Options.MarginBottom = 20
' convert a raw HTML string to a PDF document
Dim doc As PdfDocument = converter.ConvertHtmlString(html)
doc.Save("invoice.pdf")
doc.Close()
End Sub
End Module
This converter runs in-process on Windows (x86 and x64), including Azure Web Apps — no service to host. Need Linux, macOS, a non-.NET language or zero install? The HTML to PDF API is the same engine over REST. Need merge, split, digital signatures or PDF forms as well? That is the full .NET PDF library — the converter is part of it. New here? See why SelectPdf is the best HTML to PDF converter for .NET.
Paste any URL into the live demo and get a real, watermarked PDF back — rendered by this exact engine. No signup, no key.
More in the online documentation and the C# / VB.NET sample code — the rest is one email away.