Examples

Add HTMLArea to PDF

Adding an HTMLArea to a PDF using DynamicPDF Core Suite is straightforward.

How to Add HTMLArea to PDF in C#

The following steps and sample code illustrate how to add an HTMLArea to a PDF document using DynamicPDF Core Suite.

Steps for Adding HTMLArea to a PDF Document

  1. Create a Document object.
  2. Create a Uri object and pass the HTML file path.
  3. Create an HtmlArea object and pass the Uri.
  4. Create a Page and add it to the Document instance.
  5. Save the PDF Document.

Sample Code - C#

Document document = new Document();
        
Uri filePath = new Uri( inputHTMLPath );
       
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
Page page = new Page();
page.Elements.Add(htmlArea);
        
document.Pages.Add(page);
        
document.Draw(@"Output.pdf");

GitHub Project

Clone or view the example project at GitHub. This example code is contained in the Examples/HtmlAreaExample.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The easiest way to install the package is by using the Visual Studio Package Manger. You can also download the NuGet package directly.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

DynamicPDF Core Suite contains over 75 page elements you can use to add rich content to the PDFs you create. Elements include:

  • Images
  • Text Objects (TextArea and Label)
  • HTML
  • Barcodes (47 types)
  • Form Fields
  • Charts.

More information can be found at the DynamicPDF Core Suite website.

Available on Other Platforms

DynamicPDF Core Suite is also available for the following platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!