Find and extract PDF attachments
By Anton Samper · Reviewed
A PDF can carry other files inside it. Use the attachment list to find them, then inspect their references or download their contents.
Find an embedded file
- Open your PDF and choose Resources → Attachments.
- Search by filename, then select an entry to inspect its object.
- Click Download attachment in the list or inspector to save its decoded contents. Inspecting a reference does not open the attached file.
Each attachment is listed once per stream and filename, including identified embedded streams without file specifications. The size shown is the complete decoded file size where available. Resource filters persist when you inspect an object and return, and reset when you open another PDF.
Follow the references
In Document catalogue, follow /Names → /EmbeddedFiles. A name tree uses /Kids or /Names entries to lead to file specifications. Follow a file specification’s /EF reference to its embedded file stream.
This illustrative file specification is not part of a bundled sample:
<< /Type /Filespec
/F (notes.txt)
/EF << /F 12 0 R >> >>Here /F (notes.txt) names the file; 12 0 R inside /EF points to the stream holding its contents. Follow that reference and check its dictionary and decoded bytes.
Also check a page’s /Annots for /FileAttachment annotations and their /FS references, and look for associated files under /AF. Attachments may not appear in the page preview.
Understand the limits
Downloads require supported filters and are limited to 32 MiB per decoded file. Incomplete files are not downloaded. The list covers indexed objects; unavailable or unparsed objects may contain other files. An empty list does not prove that the PDF has no attachments.
For files you do not trust, continue with investigating suspicious features before opening an extracted attachment.