API reference / Quittio \ Core \ Pdf
PdfEmbeddedFileExtractor
final class in quittio/core · implements DiagnosingXmlExtractor
Quittio\Core\Pdf\PdfEmbeddedFileExtractor · Source
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 |
- Returns
?array
extractFile()#
public function extractFile(string $pdf): ?ExtractedXml| Parameter | Type | Description |
|---|---|---|
$pdf | string |
- Returns
?ExtractedXml
maxPdfBytes()#
public function maxPdfBytes(): int- Returns
int
names()#
public function names(string $pdf): list<string>Names of all embedded files.
| Parameter | Type | Description |
|---|---|---|
$pdf | string |
- Returns
list<string>