Create a PDF portfolio (package) on iOS

To create a PDF portfolio containing multiple file types.

1void AddPackage(PTPDFDoc *doc, NSString *file, NSString* desc)
2{
3 PTNameTree *files = [PTNameTree Create: [doc GetSDFDoc] name: @"EmbeddedFiles"];
4 PTFileSpec *fs = [PTFileSpec Create: [doc GetSDFDoc] path: file embed: true];
5 [files Put: [file dataUsingEncoding: NSUTF8StringEncoding] key_sz:(int)file.length value: [fs GetSDFObj]];
6 [fs SetDesc: desc];
7
8 PTObj * collection = [[doc GetRoot] FindObj: @"Collection"];
9 if (!collection) collection = [[doc GetRoot] PutDict: @"Collection"];
10
11 // You could here manipulate any entry in the Collection dictionary.
12 // For example, the following line sets the tile mode for initial view mode
13 // Please refer to section '2.3.5 Collections' in PDF Reference for details.
14 [collection PutName: @"View" name: @"T"];
15}
16PTPDFDoc *doc = [[PTPDFDoc alloc] init];
17AddPackage(doc, filename, @"PDF");
18AddPackage(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