Create Package PDF

Creating a Package PDF using DynamicPDF Core Suite is straightforward.

How to Create Package PDF in C#

The following steps and sample code illustrate creating a Package PDF document using DynamicPDF Core Suite.

Steps for Creating a Package PDF Document

  1. Create a Document object.
  2. Create a EmbeddedFile object and point to desired file.
  3. Create a Page object and add it to the Document instance.
  4. Create a DocumentPackage object and set the attachment type.
  5. Associate the DocumentPackage to Document object's package property.
  6. Add all the elements to the Page instance.
  7. Assign a DiskBufferingOptions object to the Document object's DiskBuffering property.
  8. Save the PDF document.

Sample Code - C#

Document document = new Document();

EmbeddedFile embeddedFile1 = new EmbeddedFile("myFile1.pdf");
EmbeddedFile embeddedFile2 = new EmbeddedFile("myFile2.pdf");
document.EmbeddedFiles.Add( embeddedFile1 );
document.EmbeddedFiles.Add( embeddedFile2 );

Page page = new Page();
document.Pages.Add( page );

document.Package = new DocumentPackage(AttachmentLayout.Detailed);
document.Package.OrderBy = AttachmentListingOrderBy.Name;
document.Package.AscendingOrder = false;

page.Elements.Add( new Label("Cover Page”, 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center ) );
document.Draw( "output.pdf" );

GitHub Project

Clone or view the example project at GitHub. This example code is contained in the Examples/PackagePdfExample.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 through the Visual Studio Package Manager. You can also download directly from NuGet.

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. DynamicPDF Core Suite includes elements for:

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

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

Available on Other platforms

DynamicPDF Core Suite is also available for the Java and COM/ActiveX 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!