Examples

Create PDF (.NET Core/Framework)

In the following example, you create a simple PDF document. Creating PDF documents programmatically using DynamicPDF Generator is straightforward, and you have access to the document, pages in the document, and content (using page elements) on each page.

Watch the Video

How to Create PDF

Download the NuGet package and GitHub project to get started. The following steps illustrate creating a PDF document using DynamicPDF Generator.

Steps for Creating a PDF Document

  1. Create a Document object.
  2. Create a Page object and add it to the Document.
  3. Set the PageSize as Letter and the PageOrientation as Portrait.
  4. Create a text string, labelText, create a Label object, and add the string to the label.
  5. Add the Label to the Page.
  6. Call the Document object's Draw method to draw and save the PDF document.

Sample Code - C#

Document document = new Document();

Page page = new Page(PageSize.Letter, PageOrientation.Portrait, 54.0f);
document.Pages.Add(page);

string labelText = "Hello World...\nFrom DynamicPDF Generator for .NET\nDynamicPDF.com";
Label label = new Label(labelText, 0, 0, 504, 100, Font.Helvetica, 18, TextAlign.Center);
page.Elements.Add(label);

document.Draw("Output.pdf");

Page Elements

The DynamicPDF Generator contains over 75 page elements to add rich content to your PDFs. Elements include:

  • Images,
  • Text Objects (TextArea and Label),
  • HTML,
  • Barcodes (over 47 types),
  • Form Fields,
  • Charts,
  • and many other elements.

For a complete listing, refer to the Page Elements.

Getting Started

NuGet Package

Download DynamicPDF Merger NuGet ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite includes Generator, Merger and ReportWriter.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

GitHub Example Project

Clone or view the example project at GitHub. This example is is the Examples/CreatePDF.cs file.

Clone or View Example Project on GitHub

DynamicPDF Generator Information

More information on DynamicPDF Generator can be found here:

Java and COM/ActiveX Platforms

The DynamicPDF Generator is also available for Java and COM/ActiveX. 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 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

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