Create PDF Packages
Combining multiple resources into a single PDF container (PDF package) for easier organization and sharing is a breeze when using DynamicPDF Core Suite for .NET. The following example shows you how.
How to Create PDF Package
The following steps and C# sample code illustrate creating a PDF package using DynamicPDF Core Suite for .NET.
Steps for Creating a PDF Package
- Create a
Document
object. - Create a
EmbeddedFile
object and point to desired file. - Create a
Page
object and add it to theDocument
instance. - Create a
DocumentPackage
object and set the attachment type. - Associate the
DocumentPackage
toDocument
object's package property. - Add all the elements to the
Page
instance. - Assign a
DiskBufferingOptions
object to theDocument
object'sDiskBuffering
property. - Add the
Document
object'sDraw
method to draw and 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
Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. Example code is contained in the following files.
- C# - PackagePdfExample.cs
- VB.NET - PackagePdfExample.vb
Getting Started
Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing the product.
NuGet Package
The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.
DynamicPDF Core Suite Information
DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!
For more information on Packages
- Refer to the PDF Portfolios (Package) Documentation topic, or
- Chapter 19, Embedding and Portfolios, in the book DynamicPDF Core Suite for .NET by Example available on GitHub.
Available on Other Platforms
DynamicPDF Core Suite is also available for the Java and COM/AxtiveX platforms. Refer to the respective product pages for more details.
- DynamicPDF Generator
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX
- DynamicPDF Merger
- Java - DynamicPDF Merger for Java
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX