You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is only one embedded File in it (please ignore why i use foreach here)
$pdfParser = new PdfParser();
$pdfParsed = $pdfParser->parseContent($pdfContent);
$filespecs = $pdfParsed->getObjectsByType('Filespec');
foreach ($filespecs as $filespec) {
$filespecDetails = $filespec->getDetails();
// Output:
array:7 [
"AFRelationship" => "Alternative"
"Desc" => "ZUGFeRD 2.1 Rechnung"
"EF" => array:1 [
"F" => array:3 [
"DL" => "22974"
"Length" => "1871"
"Subtype" => "text/xml"
]
]
"F" => "factur-x.xml"
"Subtype" => "text/xml"
"Type" => "Filespec"
"UF" => "factur-x.xml"
]
}
$pdfParsed->getObjectsByType('EmbeddedFile'); is not empty. so lets get the first embeddedFile
foreach ($embeddedFiles as $embeddedFile) {
$embeddedFile->getContent(); // returns Undefined variable $embeddedFile
}
expected Output should be that the variable $embeddedFile is not undefined.
Code
see above :)
Kind regards
The text was updated successfully, but these errors were encountered:
PrimeGhostDE
changed the title
Object Array is empty but there is an attachment inside given
Undefined variable in ->getObjectsByType('EmbeddedFile') but there is an attachment inside given
Oct 10, 2024
It should complain that $embeddedFiles is not defined. What happens when you do $embeddedFiles = $pdfParsed->getObjectsByType('EmbeddedFile') before the loop?
Description:
I have analyzed the bug so far, that there is a problem concerning embeddedFiles.
PDF input
Example pdf invoice.
Rechnung RE-202400282 vom 09.10.2024 zu Ihr Zeichen.pdf
Expected output & actual output
There is only one embedded File in it (please ignore why i use foreach here)
expected Output should be that the variable $embeddedFile is not undefined.
Code
see above :)
Kind regards
The text was updated successfully, but these errors were encountered: