Expand description
Embedded files and associated files (ISO 32000-1 §7.11, ISO 32000-2 §7.11.4).
Two related PDF features surface here through one EmbeddedFile model:
-
Embedded files — file streams stored inside the PDF and registered in the catalog’s
/Names /EmbeddedFilesname tree (the “attachments” panel of a viewer; ISO 32000-1). Each name maps to a file specification dictionary whose/EFentry points at the embedded-file stream. -
Associated files (
/AF) — a PDF 2.0 addition: an array of file specifications attached to the catalog, a page, an annotation, an XObject, etc., each carrying an/AFRelationshipthat states why the file is attached (/Source,/Data,/Alternative, …). This is the mechanism PDF/A-3 and ZUGFeRD/Factur-X use to embed the source XML of an invoice. PDF 2.0 requires every associated file to also appear in the/Names /EmbeddedFilestree, so the two lists usually overlap.
This module only parses and exposes metadata and the embedded stream’s
object id; it never decodes the (potentially large) payload. Callers pull the
bytes on demand via crate::PdfDocument::embedded_file_bytes, which routes
through the parser’s filter pipeline (and so respects ParseLimits).
Structs§
- Embedded
File - One embedded or associated file: the file-specification metadata plus the
object id of its embedded-file stream (when it carries one). The payload is
not decoded here — fetch it with
crate::PdfDocument::embedded_file_bytes.
Enums§
- Embedded
Source - Where an
EmbeddedFilewas discovered.
Functions§
- parse_
associated_ files - Catalog-level associated files (
/Root /AF, PDF 2.0). Empty for most files. - parse_
embedded_ files - Document-level embedded files from the catalog’s
/Names /EmbeddedFilesname tree. Empty when the document declares none. - parse_
page_ associated_ files - Page-level associated files (
/Page /AF, PDF 2.0), read off an already-resolved leaf page dictionary./AFis not an inheritable page attribute, so this looks only at the leaf.