Getting Started with Html to Pdf Converter for .NET |
SelectPdf Html To Pdf Converter - Community Edition provides a powerful and easy to use free html to pdf converter that can be used in any .NET applications to generate pdf documents from web pages and html code.
SelectPdf Html To Pdf Converter - Community Edition provides most of the features of the Professional Select.Pdf Library for .NET. The main limitation is related to the number of pages of the generated pdf documents. The community edition generates pdf documents up to 5 pages.
Using the Html to Pdf Converter is very easy. The first thing that needs to be done is the namespace importing.
Sample code that shows how to convert an url to pdf using Free Select.Pdf Html To Pdf Converter for .NET:
// instantiate a html to pdf converter object HtmlToPdf converter = new HtmlToPdf(); // create a new pdf document converting an url PdfDocument doc = converter.ConvertUrl(TxtUrl.Text); // save pdf document doc.Save(Response, false, "Sample.pdf"); // close pdf document doc.Close();
Sample code that shows how to convert raw html code to pdf using Free Select.Pdf Html To Pdf Converter for .NET:
// instantiate a html to pdf converter object HtmlToPdf converter = new HtmlToPdf(); // create a new pdf document converting the html code PdfDocument doc = converter.ConvertHtmlString(htmlString, baseUrl); // save pdf document doc.Save(Response, false, "Sample.pdf"); // close pdf document doc.Close();
Options - controls the html to pdf conversion process and the generated pdf document properties.
Header - controls the properties of the custom header of the generated pdf document.
Footer - controls the properties of the custom footer of the generated pdf document.
ConversionResult - offers information about the result of the html to pdf conversion process.
These properties will be described in details in the next sections of the Developers Guide.