---
title: "PdfEmbeddedFileExtractor – API-Referenz · Quittio"
description: "Extracts the embedded invoice XML from PDF files (ZUGFeRD 2.x, Factur-X, XRechnung in PDF)."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Pdf/PdfEmbeddedFileExtractor"
locale: de
meta:
  "og:description": "Extracts the embedded invoice XML from PDF files (ZUGFeRD 2.x, Factur-X, XRechnung in PDF)."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "PdfEmbeddedFileExtractor – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Pdf](https://quittio.dev/docs/api/Quittio/Core/Pdf)

# PdfEmbeddedFileExtractor

final class in quittio/core · implements [`DiagnosingXmlExtractor`](https://quittio.dev/docs/api/Quittio/Core/Reading/DiagnosingXmlExtractor)

`Quittio\Core\Pdf\PdfEmbeddedFileExtractor` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/Pdf/PdfEmbeddedFileExtractor.php#L31)

Extracts the embedded invoice XML from PDF files (ZUGFeRD 2.x, Factur-X, XRechnung in PDF).

Embedded files are searched in the associated files of the document (/AF, PDF/A-3) and in the name tree (/Names /EmbeddedFiles). Classic cross-reference tables, cross-reference streams and object streams are supported. All structures are limited (tree size, number of file specifications, decompressed size) as protection against malicious files, and file names are never used as paths.

## Constants \#

| Constant | Value | Description |
| --- | --- | --- |
| `KNOWN_FILENAMES` | `['factur-x.xml', 'xrechnung.xml', 'zugferd-invoice.xml', 'ZUGFeRD-invoice.xml']` | Known file names in order of preference (ZUGFeRD-invoice.xml is the ZUGFeRD 1.0 name). |

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->extract()` | |
| `->extractFile()` | |
| `->maxPdfBytes()` | |
| `->names()` | Names of all embedded files. |

### `__construct()`#

```
public function __construct(
    int $maxPdfBytes = 25 * 1024 * 1024,
    int $maxDecompressedBytes = 50 * 1024 * 1024,
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$maxPdfBytes` | `int` = `25 * 1024 * 1024` | |
| `$maxDecompressedBytes` | `int` = `50 * 1024 * 1024` | |

### `extract()`#

```
public function extract(string $pdf): ?array
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$pdf` | `string` | |

<dl><dt>Returns</dt>
<dd><code>?array</code></dd>
</dl>

### `extractFile()`#

```
public function extractFile(string $pdf): ?ExtractedXml
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$pdf` | `string` | |

<dl><dt>Returns</dt>
<dd><code>?<a href="https://quittio.dev/docs/api/Quittio/Core/Reading/ExtractedXml">ExtractedXml</a></code></dd>
</dl>

### `maxPdfBytes()`#

```
public function maxPdfBytes(): int
```

<dl><dt>Returns</dt>
<dd><code>int</code></dd>
</dl>

### `names()`#

```
public function names(string $pdf): list<string>
```

Names of all embedded files.

| Parameter | Type | Description |
| --- | --- | --- |
| `$pdf` | `string` | |

<dl><dt>Returns</dt>
<dd><code>list&lt;string&gt;</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/Pdf/PdfEmbeddedFileExtractor#webpage","@type":"WebPage","description":"Extracts the embedded invoice XML from PDF files (ZUGFeRD 2.x, Factur-X, XRechnung in PDF).","name":"PdfEmbeddedFileExtractor – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Pdf/PdfEmbeddedFileExtractor","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/Pdf/PdfEmbeddedFileExtractor"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```