Installation |
Install the converter from NuGet - the recommended way - or reference the assemblies of the download. There is no installer and nothing to register on the server.
For .NET Core, .NET 5 - .NET 11 and .NET Framework 4.6.1 or later, install ExpertPdf.HtmlToPdf.NetCore and, for the Chromium or Blink rendering engine, its engine package:
dotnet add package ExpertPdf.HtmlToPdf.NetCore dotnet add package ExpertPdf.HtmlToPdf.NetCore.Chromium.Windows
Package | Content |
|---|---|
ExpertPdf.HtmlToPdf.NetCore | The converter for .NET Standard 2.0 (.NET Core 2.0+, .NET 5 - .NET 11) and .NET Framework 4.6.1+, with the WebKit engine. 32-bit and AnyCPU processes. |
ExpertPdf.HtmlToPdf.NetCore.x64 | The same, for 64-bit processes. |
ExpertPdf.HtmlToPdf.NetCore.Chromium.Windows (.x64) | The Chromium rendering engine. |
ExpertPdf.HtmlToPdf.NetCore.Blink (.x64) | The Blink rendering engine. |
ExpertPdfHtmlToPdf (-x64) | The converter for .NET Framework 2.0 to 4.8.1 (.NET 2.0 and .NET 4.0 builds), with the WebKit engine. |
ExpertPdf.HtmlToPdf.Chromium.Windows (.x64) | The Chromium rendering engine for the ExpertPdfHtmlToPdf package. |
Match the package to the process architecture: an x86 or AnyCPU application uses the packages without the x64 suffix, a 64-bit application the x64 packages. The engine packages copy their files next to your application when it builds.
The download (a zip archive) contains:
Bin - the .NET 2.0 build: ephtmltopdf.dll (the converter), ephtmltopdf.xml (the IntelliSense documentation) and epengine.dll (the WebKit engine), and a prebuilt demo application.
Bin\.NET_4.0 - the same files built for .NET Framework 4.0 and later.
Doc - this documentation (open index.html, or the .chm file).
Samples - .NET Framework samples (C# and VB.NET) that use the assemblies of the Bin folder.
Samples_NET_10 - .NET 10 and .NET 11 samples that use the NuGet packages.
To use the assemblies in your application:
Add a reference to ephtmltopdf.dll (from Bin\.NET_4.0 for .NET Framework 4.x applications).
Keep epengine.dll in the same folder as ephtmltopdf.dll: Visual Studio copies it to your output folder with the reference. If it is missing from the output folder (some SDK-style projects), add it to the project with "Copy to Output Directory".
For the Chromium engine, extract the Chromium download (ExpertPdf-Chromium-Windows, or ExpertPdf-Chromium-Windows-x64 for 64-bit processes) and copy its Chromium-CEF-154.0.8037 folder next to your application, or set CefEnginePath to it.
The download has the x86 build; the 64-bit build is in the x64 download of the ExpertPdf toolkit and in the x64 NuGet packages.
using ExpertPdf.HtmlToPdf; PdfConverter converter = new PdfConverter(); converter.LicenseKey = "your license key"; converter.RenderingEngine = RenderingEngine.Chromium; // after installing the Chromium engine converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4; converter.SavePdfFromUrlToFile("https://www.example.com", "page.pdf");