HTML to PDF C#

Create HTML to PDF C# Applications quickly, fast and with the best quality

It is always a challenge to transfer HTML to PDF in C# when you need the accuracy and customized settings for conversion. Even if you are an experienced programmer you need additional PDF SDK tools and libraries to get HTML to PDF C# job well done. Unfortunately, many of them are poor in conversion quality and require significant time to integrate into your .NET enterprise desktop or server application. In addition, the best converter has to be stable, highly customizable, come with good error handling and better scalability then others.

BCL HTML to PDF SDK could be the best way to create PDF from HTML in C-Sharp (C#) if you need the conversion process to be easy, quick and with excellent quality of conversion. To make HTML to PDF C# application or convert HTML to PDF in C# you need to install HTML to PDF SDK and insert the code in your C# based .NET application. A few lines of C# code are all it takes to convert HTML to PDF in C# while emulating the IE8 rendering style:

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.8");
Loader oLoader = (Loader) Activator.CreateInstance(type);
Printer oPrinter = (Printer) oLoader.LoadObject("easyPDF.Printer.8");
IEPrintJob oPrintJob = oPrinter.IEPrintJob;
oPrintJob.IE8Emulation = true;

oPrintJob.PrintOut(Server.MapPath (@".\input.html"), Server.MapPath(@".\output.pdf"));
...

HTML to PDF SDK provides you with the best quality of HTML to PDF conversion in C#, as well as other programming languages.

HTML file. Basic HTML to PDF C# conversion with HTML to PDF SDK
HTML – input file (http://www.bcltechnologies.com/financial/data-mining.htm)
PDF file. Basic HTML to PDF C# conversion with HTML to PDF SDK
PDF created from HTML C# by HTML to PDF SDK Action Center

You can select any HTML file or URL and create PDF in C# in a couple of minutes. But what if you need some extra settings, like margins, save a page width or just shrink it smart? No worries, this PDF SDK allows you to use these and plenty of other features or properties.

Converting HTML to PDF in C# with multiple settings

To convert HTML to PDF file in C# with saving its original width, margins and making it grayscale (as an example):

  1. Download free HTML to PDF SDK trial which comes with plenty of useful PDF libraries;
  2. Insert the following lines of code to your .NET desktop or server application:
PDFProcessor processor = new PDFProcessor();
           Printer oPrin = new Printer();
           HTMLPrintJob oPrintJob = oPrin.HTMLPrintJob;
           oPrintJob.MarginLeft = 0;
           oPrintJob.MarginTop = 0.1;
           oPrintJob.MarginRight = 0;
           oPrintJob.MarginBottom = 0.1;
           oPrintJob.PageWidth = 11;
           oPrintJob.PageHeight = 8.5;
           PrinterSetting PrinterSettings = oPrin.PrinterSetting;
prnPrintColorType.PRN_PRINT_COLOR_GRAYSCALE;
           PrinterSettings.Save();
           try
           {
               printjob.PrintOut(Server.MapPath (@"<input file path>"), Server.MapPath(@"<output file path>"));
           }

If you would like to add metadata to your HTML to PDF C# converter here is the additional code:

PDFSettings.MetaData = true;
            PDFSettings.MetaDataTitle = "Title";
            PDFSettings.MetaDataAuthor = "Autor";
            PDFSettings.MetaDataSubject = "Subject";
            PDFSettings.MetaDataKeywords = "Keyword 1, keyword 2,...";
            PDFSettings.MetaDataCreator = "Creator";

Only three lines of code to add an error handling mechanism to your HTML to PDF C# application:

 catch (Exception ex)
           {
               MessageBox.Show(oPrintJob.ConversionResultMessage);
               MessageBox.Show(oPrintJob.PrinterResultMessage);
           }
HTML file. Converting HTML to PDF C# with multiple settings
HTML – input file (http://www.bclresearch.com/Home)
PDF file. HTML to PDF C# conversion with HTML to PDF SDK
PDF created from HTML C# with the code

PDF Features for HTML to PDF C# Programming

Application Developers can use HTML to PDF SDK to easily build PDF features into their enterprise .NET C# applications to convert Web and HTML pages to PDF. This allows your business to share web pages as HTML or as PDF. HTML to PDF SDK has a number of properties to help adapt the HTML to PDF. Conversion to better accommodate your specific needs. We make it to be the most comprehensive PDF development toolkit for your server and desktop .NET applications and support both 32-bit and 64-bit Windows OS.

Several different PrintJob types allow getting the best and precise rendering result of HTML to PDF conversion. PDF looks exactly similar to the page in a web browser. HTML to PDF API supports PDF/A & PDF/X standards for long-term archiving of electronic documents or exchange of print-ready PDF files in printing/advertising industries. It can automatically handle any exception or error message that may occur in converting HTML and Office documents to PDF.

BCL HTML to PDF SDK comes with robust error handling built into it let you merge, modify, convert HTML to PDF and many other formats as well with no trouble. Threads are monitored for time-outs to make sure that they do not stop an application’s operation. Each thread in BCL HTML to PDF SDK is isolated from other thread and does not affect their operation.

SDK’s speed and reliability are tested in our free PDF conversion service who process thousands of PDF conversions per day and runs 24/7 with no human operator.

Many enterprise software developers in the world already use the benefits from many features supported by HTML to PDF SDK such as Font Embedding & Subsetting, Image compression, Metadata, PDF Security (e.g. set permission to print, edit), Digital Signature & Stamping, Watermark, PDF Viewer setting.

Join them now by downloading HTML to PDF C# free SDK trial!

HTML to PDF C# API references

By downloading HTML to PDF API for C# you also getting the following APIs and Libraries which offer extraordinary features:

  • Transforming multiple format documents to PDF with extreme precise with PDF Printer API;
  • Merging, Splitting, Rotating, Deleting, Extracting and Optimizing PDF files with PDF Processor API;
  • Rasterizing PDF into BMP, GIF, JPEG, PNG, and TIFF image formats with PDF Converter API;
  • Extracting, inserting, and updating data in PDF Forms with PDF Document API.

Start using all the advantages of the latest version of HTML to PDF SDK and get professional support in its integration with your desktop or server .NET application today! Try it now!

Frequently Asked Questions

Read more

Why the majority of software engineers like our HTML to PDF C# converter?

We process approximately 5,000 – 10,000 PDF’s a month and have no issues so far—everything has been working out great.” — Catex

US-based BCL technical support is available to help you fully customize HTML to PDF C# conversion for your .NET enterprise and server applications. Feel free to contact us any time you need.

Join the group of our clients, convert HTML to PDF in C# with the best quality and get the professional support! Download free HTML to PDF C# SDK trial now!

Check the samples of HTML to PDF C# projects and documentation:

Sample HTML to PDF C# Project Files – learn how to prepare your server, process and manipulate PDF files, rasterize it and dial with PDF form fields;

BCL easyPDF SDK User Manual for HTML to PDF – get familiar with all HTML to PDF SDK capabilities and become a real professional in PDF developing and manipulation.

If you are looking for another solution feel free to check our PDF Creator API, Desktop Solutions, and PDF Online Converters.