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
- Create a
Document
object. - Create a
Uri
object and pass the HTML file path. - Create an
HtmlArea
object and pass the Uri. - Create a
Page
and add it to the Document instance. - 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.
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.
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.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX