atgp / factur-x

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

Need help, i have this error Glyph widths in font dictionary are not consistent with embedded font program widths. #33

Closed herizo21-dev closed 7 months ago

herizo21-dev commented 7 months ago

I create a facturx and I have no error, the file propriety is pdf/a-3 but when i make test i have Invalid PDF/A-3. So the error in the title, I get the content pdf from a html, with sannypdf after i use $writer->generate($binaryContent, $factureXxml, null, true, [], true);

I don't know where to look and how to find the bug or my mistake

benito103e commented 7 months ago

Firstly, hello @herizo21-dev, We need explanation, context and example to reproduce your issue. Without that, we won't be able to do anything. Please do a pre-analysis before creating an issue.

herizo21-dev commented 7 months ago

Firstly, hello @herizo21-dev, We need explanation, context and example to reproduce your issue. Without that, we won't be able to do anything. Please do a pre-analysis before creating an issue.

hello, sorry @benito103e i edited my first comment

benito103e commented 7 months ago

Which tool do you use to check pdf/A-3 validity ? Is your PDF generated by sannypdf (I don't know this lib) valid before adding factur-x ? Can you share a pdf example before and after ?

herizo21-dev commented 7 months ago

Which tool do you use to check pdf/A-3 validity ? Is your PDF generated by sannypdf (I don't know this lib) valid before adding factur-x ? Can you share a pdf example before and after ?

https://services.fnfe-mpe.org/

i dont have before because I just get content from a html but this is the result: 20240417-facture-DannyTrejonm&_Danny_Trejonm.pdf

1 - $binaryContent = $this->snappyPdf->getOutputFromHtml($htmls, [ 'margin-left' => '0', 'margin-right' => '0', 'margin-top' => '10', 'margin-bottom' => '12', 'footer-line' => false, 'page-size' => 'A4', 'dpi' => 150, 'footer-html' => $footer, 'footer-spacing' => '0', ]);

2 - $factureXxml = $this->generateInvoiceAdfXml($dataFacturX, $project); $writer = new Writer(); $facturxPdf = $writer->generate($binaryContent, $factureXxml, null, true, [], true); file_put_contents($filePath, $facturxPdf);

herizo21-dev commented 7 months ago

Which tool do you use to check pdf/A-3 validity ? Is your PDF generated by sannypdf (I don't know this lib) valid before adding factur-x ? Can you share a pdf example before and after ?

Does the PDF beforehand need to already be a PDF/A-3 ?

benito103e commented 7 months ago

Yes exactly, the initial pdf must be valid PDF/A for the Fx result to be valid. The error "Glyph widths in font dictionary are not consistent with embedded font program widths." is already on your pdf.

herizo21-dev commented 7 months ago

Yes exactly, the initial pdf must be valid PDF/A for the Fx result to be valid. The error "Glyph widths in font dictionary are not consistent with embedded font program widths." is already on your pdf.

Thank you very much