Embedded Files and PDF Portfolio Collections

PDF 1.4 added support for embedded files, allowing objects to be embedded into any PDF — this includes deep nesting (e.g. a PDF can contain a PDF which contains a PDF which contains a DOCX file). Via the GoToE action, links that link to embedded files inside the PDF can be created.

PSPDFKit automatically detects and shows embedded files via EmbeddedFilesViewController, which is part of the default controller group that includes outlines, bookmarks, and annotations. The embedded files group is only visible if the document contains embedded files.

Embedded files can be accessed via a document’s allEmbeddedFiles property. The EmbeddedFile object abstracts these files and allows you to copy them to disk by calling fileURLWithError().

To learn how to add embedded files to your documents, please consult the guide on how to embed and attach files to PDFs.

Preview and Open Embedded Files

You can preview file attachments directly in PSPDFKit.

You can then open a copy in third-party applications or (on iOS) in Apple’s Files app by using the share action.

PDF Portfolio Collections

In PDF 1.7, the term PDF Package was created to describe a PDF document that contains a collection dictionary. According to the PDF Reference 1.7 (12.3.5 Collections, page 370):

Beginning with PDF 1.7, PDF documents may specify how a conforming reader’s user interface presents collections of file attachments, where the attachments are related in structure or content. Such a presentation is called a portable collection.

PDF packages have been improved upon to become PDF Portfolios in Acrobat 9. In most cases, portfolios use a Flash-based interface, which was deprecated in PDF 2.0 and is unsupported. Adobe Flash no longer works on mobile devices, as Adobe stopped supporting Flash Player on 31 December 2020.

PSPDFKit has no special support for packages and portfolios other than fully exposing the embedded files.