|
|
|
|
|
EVO HTML to PDF Converter
|
for .Net
|
|
|
|
EVO HTML to PDF Converter library for .NET and .NET Core can be easily integrated into any type
of .NET application and .NET Core application, either ASP.NET web sites, Windows Forms and WPF applications
or Windows Azure Cloud services to convert URLs, HTML strings and streams, SVG
vector graphics to a PDF document, raster image or SVG vector image. You can use the converter as a
general purpose tool for converting web pages and HTML code to PDF documents and
images or you can use it as a powerful tool to instantly create nicely formatted
and easily maintainable PDF reports directly from existing HTML reports.
The HTML to PDF Converter for .NET The library does not rely on external tools or
services and does not require installation or server configuration changes, supporting
simple copy deployment. There are separate libraries for .NET Framework and for .NET Core.
The library for .NET Framework is compatible with .NET 2.0 and .NET 4.0 and the later runtimes.
The library for .NET Core was built for .NET Standard 2.0 and is compatible with .NET Core 2.0,
.NET Core 3.1, .NET Core 6.0 and later.
The converter offers full support for HTML tags, CSS styles, SVG vector graphics, page breaks
control with CSS styles, automatically repeated HTML table header on each PDF page, live URLs and internal
links in PDF, automatically generated bookmarks, HTML in the headers and footers, Unicode and right to left
text, PDF merge, split and edit.
The library was designed and tested to work reliably in multithreaded environments
and to completely release all the resources used during conversion after each conversion.
This makes it suitable for usage in high traffic ASP.NET websites and services running
a long period of time without interruption.
The product archive that you can download
from our website contains the product binaries, documentation and an extensive set
of samples for ASP.NET, Windows Forms and Windows Azure Cloud both in C# and VB.NET.
|
|
|
|
|
|
|
 |
|
Software Download |
|
|
The evaluation version of the EVO HTML to PDF Converter can be downloaded as a zip archive.
The software does not need installation. You can simply extract the archive into a folder and reference the
.NET assembly in your project.
Please check the Release Notes to see
the new features and the latest changes. You must read and accept our
End User License Agreement
before you download the software. Downloading the software from our website implies that you agreed the terms and conditions.
|
|
|
|
|
|
Note: After you unzip the archive into a folder make sure that the product
binaries and documentation files (the .dll and .chm files) were not blocked by Windows
OS. To unblock the file click the "Unblock"
button if this button is displayed in file properties in Windows Explorer.
|
|
The HTML to PDF converter library you can download from the link above works well both in 32-bit and 64-bit environments. The 64-bit environments offers
more memory for the executing processes and the version below is optimized to take advantage of this opportunity when converting very large HTML documents:
|
|
|
|
|
|
While the default version of the EVO HTML to PDF converter works both in 32-bit and 64-bit environments, the version optimized for 64-bit systems works only in
64-bit systems and it is not compatible with 32-bit environments.
|
|
The HTML to PDF converter library is also available as a
NuGet package that can be downloaded and referenced
directly from your Visual Studio project.
|
|
|
|
Features
|
|
|
|
|
|
|
|
|
|
|
 |
|
C# Code Sample for ASP.NET |
|
|
EVO HTML to PDF Converter for .NET API allows you to convert a HTML document to PDF in just a few lines a code. The programming interface is
also very rich and allows you customize the generated PDF document in various ways. The code below is copied from the Getting Started demo for
HTML to PDF Converter that you can find in the Samples folder of the software Zip package.
|
protected void convertToPdfButton_Click(object sender, EventArgs e)
{
// Create a HTML to PDF converter object with default settings
HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();
// Set license key received after purchase to use the converter in licensed mode
// Leave it not set to use the converter in demo mode
htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";
// Set HTML Viewer width in pixels which is the equivalent in converter of the browser window width
htmlToPdfConverter.HtmlViewerWidth = int.Parse(htmlViewerWidthTextBox.Text);
// Set HTML viewer height in pixels to convert the top part of a HTML page
// Leave it not set to convert the entire HTML
if (htmlViewerHeightTextBox.Text.Length > 0)
htmlToPdfConverter.HtmlViewerHeight = int.Parse(htmlViewerHeightTextBox.Text);
// Set PDF page size which can be a predefined size like A4 or a custom size in points
// Leave it not set to have a default A4 PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = SelectedPdfPageSize();
// Set PDF page orientation to Portrait or Landscape
// Leave it not set to have a default Portrait orientation for PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageOrientation = SelectedPdfPageOrientation();
// Set the maximum time in seconds to wait for HTML page to be loaded
// Leave it not set for a default 60 seconds maximum wait time
htmlToPdfConverter.NavigationTimeout = int.Parse(navigationTimeoutTextBox.Text);
// Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed
// Set this property to 0 if you don't need to wait for such asynchcronous operations to finish
if (conversionDelayTextBox.Text.Length > 0)
htmlToPdfConverter.ConversionDelay = int.Parse(conversionDelayTextBox.Text);
// The buffer to receive the generated PDF document
byte[] outPdfBuffer = null;
if (convertUrlRadioButton.Checked)
{
string url = urlTextBox.Text;
// Convert the HTML page given by an URL to a PDF document in a memory buffer
outPdfBuffer = htmlToPdfConverter.ConvertUrl(url);
}
else
{
string htmlString = htmlStringTextBox.Text;
string baseUrl = baseUrlTextBox.Text;
// Convert a HTML string with a base URL to a PDF document in a memory buffer
outPdfBuffer = htmlToPdfConverter.ConvertHtml(htmlString, baseUrl);
}
// Send the PDF as response to browser
// Set response content type
Response.AddHeader("Content-Type", "application/pdf");
// Instruct the browser to open the PDF file as an attachment or inline
Response.AddHeader("Content-Disposition", String.Format("{0}; filename=Getting_Started.pdf; size={1}",
openInlineCheckBox.Checked ? "inline" : "attachment", outPdfBuffer.Length.ToString()));
// Write the PDF document buffer to HTTP response
Response.BinaryWrite(outPdfBuffer);
// End the HTTP response and stop the current page processing
Response.End();
}
|
|
 |
|
C# Code Sample for MVC |
|
|
EVO HTML to PDF Converter for .NET can be used in any type of .NET application including ASP.NET MVC websites.
The code below is copied from the Getting Started demo for
MVC that you can find in the Samples\Other\Mvc folder of the software Zip package.
|
[HttpPost]
public ActionResult ConvertHtmlToPdf(FormCollection collection)
{
// Create a HTML to PDF converter object with default settings
HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();
// Set HTML Viewer width in pixels which is the equivalent in converter of the browser window width
htmlToPdfConverter.HtmlViewerWidth = int.Parse(collection["htmlViewerWidthTextBox"]);
// Set HTML viewer height in pixels to convert the top part of a HTML page
// Leave it not set to convert the entire HTML
if (collection["htmlViewerHeightTextBox"].Length > 0)
htmlToPdfConverter.HtmlViewerHeight = int.Parse(collection["htmlViewerHeightTextBox"]);
// Set PDF page size which can be a predefined size like A4 or a custom size in points
// Leave it not set to have a default A4 PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = SelectedPdfPageSize(collection["pdfPageSizeDropDownList"]);
// Set PDF page orientation to Portrait or Landscape
// Leave it not set to have a default Portrait orientation for PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageOrientation = SelectedPdfPageOrientation(collection["pdfPageOrientationDropDownList"]);
// Set the maximum time in seconds to wait for HTML page to be loaded
// Leave it not set for a default 60 seconds maximum wait time
htmlToPdfConverter.NavigationTimeout = int.Parse(collection["navigationTimeoutTextBox"]);
// Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed
// Set this property to 0 if you don't need to wait for such asynchcronous operations to finish
if (collection["conversionDelayTextBox"].Length > 0)
htmlToPdfConverter.ConversionDelay = int.Parse(collection["conversionDelayTextBox"]);
string url = collection["urlTextBox"];
// Convert the HTML page given by an URL to a PDF document in a memory buffer
byte[] outPdfBuffer = htmlToPdfConverter.ConvertUrl(url);
// Send the PDF file to browser
FileResult fileResult = new FileContentResult(outPdfBuffer, "application/pdf");
fileResult.FileDownloadName = "Getting_Started.pdf";
return fileResult;
}
|
|