My Account |  Site Map | Contact Us  

Pdf API for .NET: HTML (HTML Markup) to PDF Converter Demo

All Products
EO.Web Controls
EO.Pdf for .NET
HTML to PDF (Url)
HTML to PDF (HTML Markup)
PDF Creator API
PDF Reader API
PDF Page Extraction API
PDF Splitting API
PDF Merging API
PDF Encryption API
PDF Signing API
API to Fill Form Fields
EO.Wpf for .NET
EO.WebBrowser for .NET

This sample uses EO.Pdf for .NET to convert any HTML markup to PDF.

Use it in your Application

Sample code to convert HTML markup to PDF (many advanced features not shown here):

//Code to convert HTML to PDF. The following code writes output to a file. You can also write 
//output to a Stream, a PdfPage, or a PdfDocument object
HtmlToPdf.ConvertHtml(htmlCode, outputFileName);

In addition to convert it to a file, it can also convert it to any .NET Stream object. For example, you can convert it to a MemoryStream object, then retrieve the raw bytes of the PDF file from the MemoryStream and attach it to an email, all without creating any physical file at all.

There are many conversion options available. Detailed documentation and sample code about this feature can be found in the download package.

Try it Online

Enter any valid HTML code, JavaScript or CSS style, then click "Convert" button to see it in action:

Please enter the text in the image:

More samples and demos with source code can be found in the download package.

Core Features

  • Convert any valid HTML to PDF. Rendering any HTML the same as your browser does, but output as PDF;
  • Zero External Dependency. Does not depend on any Web browser on your system. Will always work regardless you install, uninstall or update your browsers;
  • Built-in CSS1, CSS2 and CSS3 support. All CSS standards are supported. Feel free to use any CSS in your HTML code;
  • Built-in Javascript Engine. All Javascript code runs exactly the same way as they would in a browser. You can also turn Javascript off;
  • Automatic and Manual Paging. The converter can automatically page the contents into multiple pages completely based on page contents or "hard page break" styles such as "page-break-before" and "page-break-after" in your HTML code;
  • Scale to Fit. Automatically scaling the HTML page to fit in PDF paper size, or use a fixed scaling factor (or not scaling at all);
  • Selectable Text and clickable Links. The generated PDF file is not a "screenshot" image. All texts in your HTML file are rendered as selectable text in PDF. All links in your HTML file are preserved;
  • Multiple output options. Output to a file? Output to a stream? Output to Web client? Output as a download file? Choose one that fits your need.
  • And much more. Try it out for free to see it in action!

Additional Resources

  • Product Documentation

    All features are explained in great details in the product documentation. It also contains complete reference information for each type, property or method;

  • Samples

    The download package contains a wide variety of samples with full C# and Visual Basic.NET source code that demonstrate how to use different feature of the EO.Pdf library.

  • Technical Support

    Still have questions? Post in our support forum or contact us and we will answer them quickly. Our turn around time is among the best in the industry.