Skip to content

Commit

Permalink
Merge pull request #31 from atgp/configure-smalot-pdf-parser
Browse files Browse the repository at this point in the history
Allow to configure Smalot pdf parser
  • Loading branch information
benito103e authored Feb 26, 2024
2 parents 7d253ee + bfc3e92 commit f4c74fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Reader
{
public const FACTURX_FILENAME = 'factur-x.xml';

public array $smalotPdfParserCfg = [];
public ?\Smalot\PdfParser\Config $smalotPdfParserConfig = null;

/**
* Extracts Factur-X XML from Factur-X PDF.
*
Expand All @@ -28,7 +31,7 @@ public function extractXML(string $pdfBinary, bool $validateXsd = true): string
$xml = false;

try {
$parser = new \Smalot\PdfParser\Parser();
$parser = new \Smalot\PdfParser\Parser($this->smalotPdfParserCfg, $this->smalotPdfParserConfig);
$pdfParsed = $parser->parseContent($pdfBinary);
$found = false;
$filespec = $pdfParsed->getObjectsByType('Filespec');
Expand Down

0 comments on commit f4c74fb

Please sign in to comment.