Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
    • .NET API Reference
      • EO.Base
      • EO.Base.UI
      • EO.Pdf
        • EO.Pdf
        • Classes
          • ClientCertificate Class
          • HtmlDocument Class
          • HtmlElement Class
          • HtmlNode Class
          • HtmlTextNode Class
          • HtmlToPdf Class
          • HtmlToPdfException Class
          • HtmlToPdfOptions Class
          • HtmlToPdfResult Class
          • HtmlToPdfSession Class
          • PageInfo Class
          • PageInfoCollection Class
          • PageStyle Class
          • Paginator Class
          • PdfAction Class
          • PdfAttachment Class
          • PdfAttachmentCollection Class
          • PdfBookmark Class
          • PdfBookmarkCollection Class
          • PdfCheckBoxField Class
          • PdfComboBoxField Class
          • PdfDestination Class
          • PdfDocInfo Class
          • PdfDocument Class
          • PdfDocumentEventArgs Class
          • PdfDocumentSecurity Class
          • PdfField Class
          • PdfFieldCollection Class
          • PdfGenericField Class
          • PdfGoToAction Class
          • PdfJavaScriptAction Class
          • PdfLaunchAction Class
          • PdfLink Class
          • PdfListBoxField Class
          • PdfListField Class
          • PdfListItem Class
          • PdfListItemCollection Class
          • PdfObject Class
          • PdfOnOffField Class
          • PdfPage Class
          • PdfPageCollection Class
          • PdfPageEventArgs Class
          • PdfPageLocation Class
          • PdfPageRectangle Class
          • PdfPageSizes Class
          • PdfPortfolio Class
          • PdfPushButtonField Class
          • PdfRadioButtonField Class
          • PdfRadioButtonGroup Class
          • PdfRender Class
          • PdfSigner Class
          • PdfTextField Class
          • PdfUriAction Class
          • PdfViewerException Class
          • PdfViewerPreference Class
          • Runtime Class
          • YRange Class
        • Enumerations
        • Delegates
      • EO.Pdf.Acm
      • EO.Pdf.Contents
      • EO.Pdf.Drawing
      • EO.Pdf.Mvc
      • EO.Web
      • EO.WebBrowser
      • EO.WebBrowser.DOM
      • EO.WebEngine
      • EO.WinForm
      • EO.Wpf
      • EO.Wpf.Gauge
      • EO.Wpf.Gauge.Shapes
      • EO.Wpf.Primitives
      • EO.Wpf.Themes.Aero
      • EO.Wpf.Themes.Classic
      • EO.Wpf.Themes.Luna
      • EO.Wpf.Themes.Metro
      • EO.Wpf.Themes.Royale
    • JavaScript API Reference
HtmlToPdf Class

HTML to PDF converter.

Namespace: EO.Pdf
Assembly: EO.Pdf (in EO.Pdf.dll)

Inheritance Hierarchy

System.Object
   EO.Pdf.HtmlToPdf

Syntax
 public class HtmlToPdf
Remarks

Use this class to convert any Web page Url or HTML text to a PDF file, to a Stream or to a PdfPage. For example, the following code convert Google's home page to a PDF file named "google_home_page.pdf":

//Convert a Url to PDF file
HtmlToPdf.ConvertUrl("http://www.google.com", "google_home_page.pdf");

You can also configure various options through the HtmlToPdf object's Options property. For example, the following code set the output page size to be A3:

//Set output page size
HtmlToPdf.Options.PageSize = PdfPageSizes.A3;

//Convert the Url
HtmlToPdf.ConvertUrl("http://www.google.com", "google_home_page.pdf");

In addition to converting Url, you can also convert an HTML file or HTML markup directly. The following code convert HTML file "c:\hello.html" or HTML markup "<b>Hello!</b>" directly:

//Convert a HTML file to PDF file
HtmlToPdf.ConvertUrl("c:\\hello.html", "hello.pdf");

//Convert HTML markup to PDF file
HtmlToPdf.ConvertHtml("&lt;b&gt;Hello!&lt;/b&gt;", "hello.pdf");

You can convert Url or HTML markup to a physical file or directly to an output Stream or PdfPage without creating a PDF file. See ConvertUrl and ConvertHtml for more details.

See Also