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
- Create a
Document
object. - Create a
EmbeddedFile
object and point to desired file. - Create a
Page
object and add it to the Document instance. - Create a
DocumentPackage
object and set the attachment type. - Associate the
DocumentPackage
to Document object's package property. - Add all the elements to the Page instance.
- Assign a DiskBufferingOptions object to the Document object's DiskBuffering property.
- 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.
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.
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.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX