> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/ios/portfolios/create.md).

# Create a PDF portfolio (package) on iOS

Learn how to create a PDF portfolio with multiple file types using this code sample. Explore how to create, extract, and manipulate PDF Packages efficiently. The Apryse iOS SDK streamlines secure docu

To create a PDF portfolio containing multiple file types.

{% tabs %}
{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
void AddPackage(PTPDFDoc *doc, NSString *file, NSString* desc)
{
	PTNameTree *files = [PTNameTree Create: [doc GetSDFDoc] name: @"EmbeddedFiles"];
    PTFileSpec *fs = [PTFileSpec Create: [doc GetSDFDoc] path: file embed: true];
	[files Put: [file dataUsingEncoding: NSUTF8StringEncoding] key_sz:(int)file.length value: [fs GetSDFObj]];
	[fs SetDesc: desc];

	PTObj * collection = [[doc GetRoot] FindObj: @"Collection"];
	if (!collection) collection = [[doc GetRoot] PutDict: @"Collection"];

	// You could here manipulate any entry in the Collection dictionary.
	// For example, the following line sets the tile mode for initial view mode
	// Please refer to section '2.3.5 Collections' in PDF Reference for details.
	[collection PutName: @"View" name: @"T"];
}
PTPDFDoc *doc = [[PTPDFDoc alloc] init];
AddPackage(doc, filename, @"PDF");
AddPackage(doc, imagename, @"Image");
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
func AddPackage(doc: PTPDFDoc, file: String, desc: String) {
    let files: PTNameTree = PTNameTree.create(doc.getSDFDoc(), name: "EmbeddedFiles")
    let fs: PTFileSpec = PTFileSpec.create(doc.getSDFDoc(), path: file, embed: true)
    let data: Data! = file.data(using: .utf8)
    files.put(data, key_sz: Int32(data.count), value: fs.getSDFObj())
    fs.setDesc(desc)

    let collection: PTObj
    if let optCollection: PTObj = doc.getRoot().find("Collection") {
        collection = optCollection
    } else {
        collection = doc.getRoot().putDict("Collection")
    }

    // You could here manipulate any entry in the Collection dictionary.
    // For example, the following line sets the tile mode for initial view mode
    // Please refer to section '2.3.5 Collections' in PDF Reference for details.
    collection.putName("View", name: "T")
}
let doc: PTPDFDoc = PTPDFDoc()
AddPackage(doc: doc, file: filename, desc: "PDF")
AddPackage(doc: doc, file: imagename, desc: "Image")
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDF packages (portfolios)](/ios/get-started/samples.md#pdfpackage) Full code sample which illustrates how to create, extract, and manipulate PDF Packages (also known as PDF Portfolios).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/ios/portfolios/create.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
