Create a PDF portfolio (package) in UWP

To create a PDF portfolio containing multiple file types.

C#

1void AddPackage(PDFDoc doc, string file, string desc)
2{
3 NameTree files = NameTree.Create(doc, "EmbeddedFiles");
4 FileSpec fs = FileSpec.Create(doc, file, true);
5 byte[] file1_name = System.Text.Encoding.UTF8.GetBytes(file);
6 files.Put(file1_name, fs.GetSDFObj());
7 fs.GetSDFObj().PutText("Desc", desc);
8
9 Obj collection = doc.GetRoot().FindObj("Collection");
10 if (collection == null) collection = doc.GetRoot().PutDict("Collection");
11
12 // Manipulate any entry in the Collection dictionary.
13 // For example, the following line sets the tile mode for initial view mode
14 // Please refer to section '2.3.5 Collections' in PDF Reference for details.
15 collection.PutName("View", "T");
16}
17PDFDoc doc = new PDFDoc();
18AddPackage(doc, filename, "PDF");
19AddPackage(doc, imagename, "Image");

PDF packages (portfolios)
Full code sample which illustrates how to create, extract, and manipulate PDF Packages (also known as PDF Portfolios).

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales