Extract embedded files from PDF
extract_attachmentsExtract embedded files from non-encrypted PDFs (PDF/A-3, Factur-X, ZUGFeRD). Returns metadata and decoded payload, with optional single-file or metadata-only extraction.
Instructions
Read-only extraction of embedded files from a non-encrypted PDF (PDF/A-3 / Factur-X / ZUGFeRD). Walks the catalog /Names → /EmbeddedFiles tree and returns each attachment's metadata (name, mimeType, AFRelationship, description, sizeBytes) plus, by default, its decoded payload as dataBase64. Completes the invoice round-trip: add_attachment → inspect_pdf → extract_attachments. Pass filename to pull a single named file, or includeData: false for a metadata-only probe. Encrypted PDFs are rejected with EXTRACTION_UNSUPPORTED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Optional dot-path projection applied to the structured result (e.g. ['attachments.name']). Composes after verbosity. Unknown paths are omitted. | |
| filename | No | Optional exact attachment name to extract. When omitted, every embedded file is returned. | |
| pdfBase64 | Yes | Base64-encoded PDF bytes to read embedded files from. | |
| verbosity | No | Response verbosity. 'full' (default) returns the attachments[] array; 'summary' returns a token-frugal { attachmentCount } and drops the array. | full |
| includeData | No | When true (default) each attachment carries its decoded payload as dataBase64. Set false for a metadata-only probe (names, sizes, relationships) with no payload bytes. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attachments | Yes | ||
| attachmentCount | Yes |