As we all know, PDF may contain a variety of content and interactive elements. In addition to transforming HTML to PDF quickly, you may require the output document contains rich contents and effects for better viewing and communication. This requires the rendering is extremely accurate and powerful. Then, the output PDF will keeps what you need, like outline, texts, fonts, tables, images, and layout of the original HTML source. Unfortunately, you may have searched on Google and found that not all HTML converter can deal with it as expected.

XsHtml .NET HTML to PDF SDK is a powerful converter that can be used in C# applications to convert HTML page and string to PDF, while keeping its original effect. This HTML converter has been designed to work reliably in multi-threaded environments. If you want to convert HTML to PDF in C# and preserves its outline and other original effects, do not hesitate to test XsPDF. We did good job in all our strictly tests.


How to Convert HTML and Create Outline for PDF

XsHtml .NET HTML to PDF SDK is easy to save and convert HTML to PDF with a few lines of C# code. Various html to pdf APIs are provided for your customization. Please see a simple html to pdf conversion example as below.

string html = @"sample.html";
string savePath = "sample.pdf";

// Create a Html converter instance 
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// Weather need outline in PDF
converter.CreateOutline = true;

// Set output PDF size
converter.PageSize = PageSize.A4;
           
// Convert html to PDF
converter.ConvertFromFile(html, savePath);

Notice - If you use the free trial version of .NET HTML to PDF SDK, there is a statement in PDF page footer, "This is an XsPDF trial version"