An embedded attachment is a file stored inside a PDF document. Examples include:
- XML files
- CSV files
- Spreadsheets
- CAD files
- Images
- Source documents
- Digital invoices
- Supporting documentation
In standard PDF, any file type can be embedded using the EmbeddedFiles name tree and file specification dictionaries.
The relationship between PDF/A and attachments depends on the PDF/A conformance level and version.
Why PDF/A Restricts Attachments
PDF/A is an archival standard designed for long-term preservation.
The primary goals are:
- Self-contained documents
- Predictable rendering
- No external dependencies
- Long-term accessibility
Attachments can create preservation problems because:
- Software required to open the attachment may become unavailable.
- The attachment may contain executable content.
- The attachment may not be preserved correctly.
- The attachment may not be related to the archival purpose.
For these reasons, earlier PDF/A versions heavily restrict attachments.
PDF/A Versions and Attachment Support
|
PDF/A Version |
ISO Standard |
Attachments Allowed |
|
PDF/A-1 |
ISO
19005-1 |
No |
|
PDF/A-2 |
ISO
19005-2 |
Yes
(restricted) |
|
PDF/A-3 |
ISO
19005-3 |
Yes |
|
PDF/A-4 |
ISO
19005-4 |
Yes |
|
PDF/A-4e |
ISO
19005-4 |
Yes |
|
PDF/A-4f |
ISO
19005-4 |
Yes |
PDF/A-1 and Attachments
PDF/A-1 is based on PDF 1.4.
Embedded files are prohibited.
If a document contains:
/Names
/EmbeddedFiles
the file cannot be PDF/A-1 compliant.
PDF/A-2 and Attachments
PDF/A-2 permits embedding only PDF/A-compliant documents.
Example:
Main.pdf
└── Attached:
ArchivedInvoice.pdfIf:
ArchivedInvoice.pdfis also PDF/A-compliant, validation succeeds.
If attached file is:
invoice.xlsxvalidation fails.
PDF/A-3 and Attachments
PDF/A-3 was a major change.
Any file type may be attached.
Examples:
- XML
- CSV
- DOCX
- XLSX
- ZIP
- CAD
- Images
- Other PDFs
The PDF document remains the archival object.
The attachment does not need to be archivable itself.
PDF/A-4 Attachment Model
PDF/A-4 is based on ISO 32000-2 (PDF 2.0).
Attachment support becomes cleaner and more standardized.
Key features:
- Embedded files allowed
- Associated files framework
- Better metadata integration
- Improved relationship handling
PDF/A-4 relies heavily on Associated Files (AF).
Associated Files (AF)
PDF 2.0 introduced the /AF array.
Example:
Catalog
/AF [
fileSpec1
fileSpec2
]
This explicitly declares files associated with the document.
Benefits:
- Clear relationship
- Better preservation
- Machine-readable associations
- Improved validation
PDF/A-4e
The "e" means: "Engineering"
Designed for technical documentation.
Typical attachments:
- CAD
- STEP
- IFC
- BIM
- 3D engineering data
Example:
Drawing.pdf
└─ model.step
Valid.
PDF/A-4f
The "f" means:: "File Attachments"
This conformance level explicitly supports arbitrary embedded files.
Example:
Package.pdf
├─ model.step
├─ source.xml
├─ spreadsheet.xlsx
└─ image.tif
All valid.
Required Attachment Components
A valid attachment typically contains:
1. Embedded File Stream
/Type /EmbeddedFile
Contains the actual file data.
2. File Specification Dictionary
Example:
<<
/Type /Filespec
/F (invoice.xml)
/UF (invoice.xml)
/EF <<
/F embeddedFile
>>
>>
3. MIME Type
Should identify file content.
Example:
/Subtype (application/xml)
Examples:
| File Type | MIME Type |
|---|---|
| XML | application/xml |
| CSV | text/csv |
| TXT | text/plain |
| application/pdf | |
| JPEG | image/jpeg |
| PNG | image/png |
| DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| XLSX | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
4. AFRelationship
Defines how the attachment relates to the PDF.
Examples:
| Value | Meaning |
|---|---|
| Source | Source document |
| Data | Supporting data |
| Alternative | Alternate representation |
| Supplement | Supplemental information |
| Unspecified | Relationship unknown |
Example:
/AFRelationship /Data
Typical PDF/A Attachment Structure
Simplified example:
Catalog
├─ Metadata
├─ Pages
├─ AF
│ └─ File Specification
│ ├─ AFRelationship
│ ├─ Embedded File
│ └─ MIME Type
└─ EmbeddedFiles
ZUGFeRD and Factur-X Example
Electronic invoice standards such as:
- ZUGFeRD
- Factur-X
commonly use:
- PDF/A-3
- Embedded XML invoice
Structure:
PDF/A-3
├─ Human-readable invoice
└─ XML invoice attachment
Relationship:
/AFRelationship /Alternative
This means:
- PDF = visual invoice
- XML = machine-readable invoice
Both represent the same invoice.
Best Practices
Use PDF/A-3 or PDF/A-4
For modern workflows involving attachments.
Set Correct MIME Types
Always identify content accurately.
Use AFRelationship
Never leave relationships ambiguous when a known relationship exists.
Add Metadata
Include:
- File name
- Description
- Creation date
- MIME type
Quick Summary
|
Feature |
PDF/A-1 |
PDF/A-2 |
PDF/A-3 |
PDF/A-4 |
PDF/A-4e |
PDF/A-4f |
|
Embedded
Files |
No |
Yes |
Yes |
Yes |
Yes |
Yes |
|
Any
File Type |
No |
Restricted |
Yes |
Yes |
Yes |
Yes |
|
Associated
Files (AF) |
No |
Limited |
Supported |
Full
PDF 2.0 Support |
Full |
Full |
|
AFRelationship |
N/A |
Recommended |
Required
for AF |
Required |
Required |
Required |
|
Typical
Use |
Archive
PDF |
Archive
+ Data |
E-Invoicing |
Modern
Archiving |
Engineering |
Archive
+ Attachments |
In practice, PDF/A-3 and PDF/A-4f are the most common standards when documents need to carry embedded XML, spreadsheets, CAD files, or other supporting data. PDF/A-1 should be avoided for attachment-based workflows because it completely prohibits embedded files.
Comments
Post a Comment