Click or drag to resize
Pdf Library for .NET

HtmlToPdf Class

Html To Pdf Converter. This class offers the API needed to convert any web page url or html string to pdf.
Inheritance Hierarchy
SystemObject
  SelectPdfHtmlToPdf

Namespace:  SelectPdf
Assembly:  Select.Pdf (in Select.Pdf.dll) Version: 24.1
Syntax
public class HtmlToPdf

The HtmlToPdf type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleHtmlToPdf
Initializes an instance of the HtmlToPdf Converter.
Public methodCode exampleHtmlToPdf(Int32)
Initializes an instance of the HtmlToPdf Converter.
Public methodCode exampleHtmlToPdf(Int32, Int32)
Initializes an instance of the HtmlToPdf Converter.
Top
Properties
  NameDescription
Public propertyConversionResult
Gets a reference to an object that offers information about the result of the html to pdf conversion process.
Public propertyFooter
Gets a reference to an object that controls the properties of the custom footer of the generated pdf document.
Public propertyHeader
Gets a reference to an object that controls the properties of the custom header of the generated pdf document.
Public propertyOptions
Gets a reference to an object that controls the html to pdf conversion process and the generated pdf document properties.
Top
Methods
  NameDescription
Public methodCode exampleConvertHtmlString(String)
Gets a PdfDocument object representing the result of the conversion of the specified html string to pdf.
Public methodCode exampleConvertHtmlString(String, String)
Gets a PdfDocument object representing the result of the conversion of the specified html string to pdf.
Public methodCode exampleConvertUrl
Gets a PdfDocument object representing the result of the conversion of the specified url to pdf.
Top
Remarks
The result of conversion is a PdfDocument object that can be further modified, saved to memory or into a file on the disk.
Examples
The following sample code shows how an HtmlToPdf Converter can be instantiated and a basic conversion performed.
using SelectPdf;
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl(url);
doc.Save(file);
doc.Close();
See Also