Click or drag to resize
Pdf Library for .NET

HtmlToPdfException Class

The exception thrown when an HTML to PDF conversion fails, for example on a navigation timeout, an unreachable URL, or a rendering engine error. Catch it around ConvertUrl(String) / ConvertHtmlString(String).
Inheritance Hierarchy
SystemObject
  SystemException
    SelectPdf.UniversalHtmlToPdfException

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class HtmlToPdfException : Exception

The HtmlToPdfException type exposes the following members.

Constructors
 NameDescription
Public methodHtmlToPdfException(String) Initializes a new instance of the HtmlToPdfException class with a specified error message.
Public methodHtmlToPdfException(String, Exception) Initializes a new instance of the HtmlToPdfException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Top
Example
HtmlToPdf converter = new HtmlToPdf();
try
{
    PdfDocument doc = converter.ConvertUrl("https://www.google.com");
    doc.Save("out.pdf");
    doc.Close();
}
catch (HtmlToPdfException ex)
{
    System.Console.WriteLine("Conversion failed: " + ex.Message);
}
See Also