atgp / factur-x

PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files
MIT License
94 stars 22 forks source link

Allow to pass parser config object #30

Closed ElGigi closed 8 months ago

ElGigi commented 8 months ago

Allow to pass SmalotPDF parser config object to the Reader service.

Regards.

benito103e commented 8 months ago

Hello, I like this, but shouldn't we be able to pass the \Smalot\PdfParser\Parser as a parameter to the Reader constructor? This would allow the Parser configuration to be fully adjusted upstream. Thanks in advance for your opinion.

ElGigi commented 8 months ago

Hello, I like this, but shouldn't we be able to pass the \Smalot\PdfParser\Parser as a parameter to the Reader constructor? This would allow the Parser configuration to be fully adjusted upstream. Thanks in advance for your opinion.

I wanted to take this approach, but the Parser object stores objects in memory without necessarily releasing them after parsing. This would therefore not have been optimal.

benito103e commented 8 months ago

You're right !

What do you think about adding 2 properties with getter/setter :

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

See #31

ElGigi commented 8 months ago

It's nice too 👍

benito103e commented 8 months ago

Solved with #31