Introduction to our HTML to PDF Converter Library for .NET

Pdf

The OfficeComponent PDF lets you add the capability to convert any HTML webpage to PDF documents by just adding a few lines of code. The HtmlToPdfConverter class allows you to set several advanced conversion options. We take advantage of that class with the following code snippet:

// Create a new converter.
var c = new HtmlToPdfConverter()
{	
	ViewportWidth = Width,
	ViewportHeight = Height,
	PageSize = PageSize,
	PageMargin = Margin,
	Portrait = Portrait,
	Delay = ConversionDelay,
	Timeout = Timeout,

	SinglePage = SinglePage
};

// Convert URL
c.ConvertAsync(Url, outputPath, OnConversionComplete);

If you wish to convert an HTML string to PDF, use the following line of code instead

// Convert the specified HTML string.
c.ConvertStringAsync(HtmlString, HtmlStringBaseUrl, outputPath, OnConversionComplete);

The full source code of this example is available in our PDF package.

A live demo for converting HTML to PDF is also available on our site. If you also need PDF functionality, check out our PDF online demos.

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now

Dont miss out Get update on new articles and other opportunities