- Getting Started
- Memory Usage
- Readers and Writers
- The Document Class
- Page Layout and Mode
- Viewer Preferences
- Document Outline
- Page Labels
- Embedded File Streams
- Colors and Color Spaces
- Page Formats and Boundaries
- Standard and Public Key Encryption
- Fonts and Encodings
- Corrupted Documents
- Reader Enabled Documents
- Refactor Old SetaPDF Code
- API Reference
Embedded File Streams
Table of Contents
Embedded file streams allow you to embedded an external file directly within the body of a PDF file. This embedded file streams are referenced by a file specification then, which can be attached to the global embedded files name tree or a file attachment annotation.
An embedded file stream is represented by the
SetaPDF_Core_EmbeddedFileStream class which offers following getter and setter methods:
Create an embedded file stream.
Get the subtype of the embedded file.
Get the entries and data of the embedded file parameter dictionary.
Set the mime type (or subtype) of the embedded file stream.
Set the entries in the embedded file parameter dictionary.
An embedded file stream is referenced by a file specification through its EF (embedded file stream) entry. A file specification offers several other methods:
Create a file specification with an embedded file stream.
Get the collection item data.
Get the descriptive text associated with the file specification.
Get the dictionary.
Get the embedded file stream object.
Get the file specification value.
Get name of the file system.
Get the unicode text file specification value.
Get the volatile flag.
Set the collection item data.
Set the descriptive text associated with the file specification.
Set the embedded file stream object.
Set the file specification value.
Set the file system name.
Set the unicode text file specification value.
Set the volatile flag.
To create a file specification with an embedded file stream you should use the static helper method
The EmbeddedFiles name tree maps name strings to file specifications for embedded file streams. It is represented by the
SetaPDF_Core_Document_Catalog_Names_EmbeddedFiles which can be resolved by following code:
$document = new SetaPDF_Core_Document(); //... $embeddedFiles = $document->getCatalog()->getNames()->getEmbeddedFiles();
Adds an embedded file by its file specification.
Get an embedded file by its name.
Get all embedded files.
Remove an embedded file.
The registered names should be PDF strings (PDFDoc encoding or UTF-16BE including BOM).
Keep in mind that name parameter are encoding specific.