Examples

Create PDF

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

Watch the Video

How to Create a PDF

The following steps illustrate creating a PDF document using DynamicPDF Core Suite.

Steps for Creating a PDF Document

  1. Create a Document object.
  2. Create a Page object and add it to the Document instance.
  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 instance to the page Instance.
  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 Core Suite contains over 75 page elements to add rich content to your PDFs. DynamicPDF Core Suite includes elements for creating:

  • 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.

GitHub Project

Clone or view the example project at GitHub. The examples on this page are in the Examples/CreatePDF.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

The DynamicPDF Core Suite package is available as a NuGet ceTe.DynamicPDF.CoreSuite.NET package. The easiest way to install the package is through the Visual Studio Package Manager. You can also download the package directly from NuGet.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

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

Other Platforms

DynamicPDF Core Suite 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 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

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