Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] XML from PDF not been found #135

Closed
PrimeGhostDE opened this issue Oct 9, 2024 · 13 comments
Closed

[QUESTION] XML from PDF not been found #135

PrimeGhostDE opened this issue Oct 9, 2024 · 13 comments
Assignees
Labels
question Further information is requested

Comments

@PrimeGhostDE
Copy link

Describe the bug
Invoices from Sage as E-Rechnung (Type: Zugferd 2.2 / 2.1) are not recognized as E-Rechnung but also Acrobat PDF-Reader and https://belegmeister.de/zugferd-e-rechnungen-online-anzeigen/ have found an XML inside. The PDF and the XML can be opened from Acrobat PDF Reader.

To Reproduce
The Invoice itself is difficult to send because private Information is inside. (Please PM me if needed)
ZugferdDocumentPdfReader::readAndGuessFromFile(Storage::path($dokument->path . '/' . $dokument->filename)) returns null.
No Error is thrown.

ZugferdDocumentPdfReader:
$attachmentIndex is 0 when in_array($filespecDetails['F'], ZugferdDocumentPdfReader::ATTACHMENT_FILENAMES) is found [factur-x.xml]
$embeddedFiles = $pdfParsed->getObjectsByType('EmbeddedFile'); returns an empty array.
so $returnValue = ZugferdDocumentReader::readAndGuessFromContent($embeddedFile->getContent()); is been done on empty data.

So far i am sure, that there might be a problem in smalot/pdfparser. (Going to open there an issue asap)
But if you do have any further steps to check i am very welcome about.

Expected behavior
return of valid object

Additional information:

  • OS: Windows
  • OS-Version Windows 10
  • PHP-Version PHP 8.2
@PrimeGhostDE PrimeGhostDE added the bug Something isn't working label Oct 9, 2024
@horstoeko horstoeko added question Further information is requested and removed bug Something isn't working labels Oct 9, 2024
@horstoeko horstoeko changed the title [BUG] XML from PDF not been found [QUESTION] XML from PDF not been found Oct 9, 2024
@horstoeko
Copy link
Owner

Hi @PrimeGhostDE,

I'm really not sure if and how I can help with this. Obviously this doesn't seem to be a problem with my library, so I'm leaning towards opening an issue at smalot/pdfparser. Which may well be that the XML is not embedded correctly in the PDF - but that's just a guess. Sometimes it helps to use the validator of the ZUGFeRD community and/or VeraPDF.

Best regards.

@PrimeGhostDE
Copy link
Author

PrimeGhostDE commented Oct 9, 2024

Hi HorstOeko,

currently i am facing the issue that it seems not to be an embeddedFile:

Dump of $filespec->getDetails();

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"
]

The XML is some sort of "Filespec" type.

Edit:
if i change the line to $embeddedFiles = $pdfParsed->getObjectsByType('Filespec');
An Error is thrown.

exception: "horstoeko\zugferd\exception\ZugferdUnknownXmlContentException"
file: "xxx\vendor\horstoeko\zugferd\src\ZugferdProfileResolver.php"
line: 47
message: "The XML does not match the requirements for an XML in CII-Syntax"

How can i check the Syntax for the XML? (oder bin ich auf dem Holzweg?!)

@PrimeGhostDE
Copy link
Author

PrimeGhostDE commented Oct 9, 2024

XML of the File:

<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
<rsm:ExchangedDocumentContext>
<ram:TestIndicator>
<udt:Indicator>false</udt:Indicator>
</ram:TestIndicator>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>RE-202300281</ram:ID>
<ram:Name>RECHNUNG</ram:Name>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20231231</udt:DateTimeString>
</ram:IssueDateTime>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>1</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>001</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">2.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>3</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>002</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.50</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>5</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>003</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.25</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>7</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>004</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.50</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>9</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>005</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.25</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>11</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>006</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>70.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.50</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>13</ram:LineID>
<ram:LineStatusReasonCode>Information</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID></ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Information</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">0.00</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>007</ram:LineID>
<ram:LineStatusReasonCode>Detail</ram:LineStatusReasonCode>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0088"></ram:GlobalID>
<ram:SellerAssignedID>Stundensatz</ram:SellerAssignedID>
<ram:BuyerAssignedID></ram:BuyerAssignedID>
<ram:Name>Stundensatz</ram:Name>
<ram:Description></ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>0.00</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1.00</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">4.50</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:ApplicableHeaderTradeAgreement>
<ram:SellerTradeParty>
<ram:GlobalID schemeID="0021">XXX</ram:GlobalID>
<ram:Name>XXX</ram:Name>
<ram:DefinedTradeContact>
<ram:PersonName>Admin</ram:PersonName>
<ram:TelephoneUniversalCommunication><ram:CompleteNumber>XXX</ram:CompleteNumber></ram:TelephoneUniversalCommunication>
<ram:EmailURIUniversalCommunication><ram:URIID>XXX</ram:URIID></ram:EmailURIUniversalCommunication>
</ram:DefinedTradeContact>
<ram:PostalTradeAddress>
<ram:PostcodeCode>XXX</ram:PostcodeCode>
<ram:LineOne>XXX</ram:LineOne>
<ram:CityName>XXX</ram:CityName>
<ram:CountryID>XXX</ram:CountryID>
</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">XXX</ram:ID></ram:SpecifiedTaxRegistration>
<ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">XXX</ram:ID></ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:ID>XXX</ram:ID>
<ram:Name>XXX</ram:Name>
<ram:DefinedTradeContact>
<ram:PersonName>XXX</ram:PersonName>
</ram:DefinedTradeContact>
<ram:PostalTradeAddress>
<ram:PostcodeCode>XXX</ram:PostcodeCode>
<ram:LineOne>XXX</ram:LineOne>
<ram:CityName>XXX</ram:CityName>
<ram:CountryID>XXX</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
<ram:ActualDeliverySupplyChainEvent>
<ram:OccurrenceDateTime>
<udt:DateTimeString format="102">20231231</udt:DateTimeString>
</ram:OccurrenceDateTime>
</ram:ActualDeliverySupplyChainEvent>
<ram:DeliveryNoteReferencedDocument>
<ram:IssuerAssignedID>ZE-2023120222</ram:IssuerAssignedID>
<ram:FormattedIssueDateTime>
<qdt:DateTimeString format="102">20231231</qdt:DateTimeString>
</ram:FormattedIssueDateTime>
</ram:DeliveryNoteReferencedDocument>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>49</ram:TypeCode>
<ram:Information>Bankeinzug/Online</ram:Information>
<ram:PayerPartyDebtorFinancialAccount>
<ram:IBANID>XXX</ram:IBANID>
</ram:PayerPartyDebtorFinancialAccount>
</ram:SpecifiedTradeSettlementPaymentMeans>
<ram:ApplicableTradeTax>
<ram:CalculatedAmount>0</ram:CalculatedAmount>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:BasisAmount>0.00</ram:BasisAmount>
<ram:LineTotalBasisAmount>0.00</ram:LineTotalBasisAmount>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:ApplicableTradeTax>
<ram:CalculatedAmount>0</ram:CalculatedAmount>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:ExemptionReason>Textposition</ram:ExemptionReason>
<ram:BasisAmount>0</ram:BasisAmount>
<ram:CategoryCode>E</ram:CategoryCode>
<ram:RateApplicablePercent>0.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradePaymentTerms>
<ram:Description></ram:Description>
<ram:DueDateDateTime><udt:DateTimeString format="102">20231231</udt:DateTimeString></ram:DueDateDateTime>
</ram:SpecifiedTradePaymentTerms>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
<ram:ChargeTotalAmount>0.00</ram:ChargeTotalAmount>
<ram:AllowanceTotalAmount>0.00</ram:AllowanceTotalAmount>
<ram:TaxBasisTotalAmount>0.00</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">0.00</ram:TaxTotalAmount>
<ram:RoundingAmount>0.00</ram:RoundingAmount>
<ram:GrandTotalAmount>0.00</ram:GrandTotalAmount>
<ram:DuePayableAmount>0.00</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

@PrimeGhostDE
Copy link
Author

If I use ZugferdDocumentReader::readAndGuessFromContent(file_get_contents(Storage::path('temp/factur-x.xml'))); on the XML it is working....

So I expect a problem asside the extraction of the XML -.-

@horstoeko
Copy link
Owner

Hi @PrimeGhostDE,

So I expect a problem asside the extraction of the XML -.-

I'm glad you were able to get to grips with the problem. But anyway: The PDF is embedded incorrectly - and even the best PDF parser can't change that... :-) I can try to implement a certain fallback when I get the chance.

Would you be so kind as to send me the original PDF by e-mail via Mail?

Many thanks and best regards

@PrimeGhostDE
Copy link
Author

Thank you :)
I came now across, that

$embeddedFile->getContent();

returns empty string.

So i might have been wrong with "$embeddedFiles = $pdfParsed->getObjectsByType('EmbeddedFile'); returns an empty array."
The array counts 1 elements. So it gets stuck on $embeddedFile->getContent().

@horstoeko
Copy link
Owner

horstoeko commented Oct 9, 2024

Hi @PrimeGhostDE,

Once again: everything works great. All tests are green - including the PDF tests. I can't do anything here. The problem is not with my library. Without exception, all valid PDF files are read correctly. The XML is embedded incorrectly - I'm sticking to that. So please tell me how I can help you...

Kind regards

@PrimeGhostDE
Copy link
Author

I have send you a test invoice via E-Mail :-)
Thank you in advance

@horstoeko
Copy link
Owner

horstoeko commented Oct 9, 2024

Hi @PrimeGhostDE,

I have just debugged with the help of your file. As I had already suspected several times, this file is not correctly mounted as an embedded file. Unfortunately, there is nothing I can do here and I can only recommend that you contact the service provider. That's all I can think of at the moment...

Appendix: As you can see, there is no embedded file. You can - of course - make an issue to smalot/pdfparser.

grafik

I've put that PDF to the Validator of the ZUGFeRD-Community... With the following result....

Das XML ist nicht valide.

Profil: urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended
Bestandene Regeln: 70
Gescheiterte Regeln: 1

Details
Error
Value of 'ram:LineStatusReasonCode' is not allowed. [ID FX-SCH-A-000335] from /xslt/ZF_230/FACTUR-X_EXTENDED.xslt)
/:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/:SupplyChainTradeTransaction[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/:IncludedSupplyChainTradeLineItem[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/:AssociatedDocumentLineDocument[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:LineStatusReasonCode[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]

Das ZUGFeRD-PDF ist nicht valide.

Signatur: unknown

Can we close this issue?

Kind regards

Repository owner locked and limited conversation to collaborators Oct 9, 2024
Repository owner unlocked this conversation Oct 9, 2024
@PrimeGhostDE
Copy link
Author

Hi @horstoeko,

thank you very much for checking the invoice.
The Validation is not the problem here. As almost the validation is done incorrectly:

image

The main problem for me was that the XML is not being extracted from the pdf.
If i extract the XML manually and insert it to your tool it is parsed correctly and i do have access to all the values.

Kind regards

@horstoeko
Copy link
Owner

Hi @PrimeGhostDE,

So. Thank you for the information. What is the screenshot supposed to tell me? Unfortunately, I don't understand it. Can we close this issue?

Kind regards

@PrimeGhostDE
Copy link
Author

PrimeGhostDE commented Oct 10, 2024

Hi @horstoeko,

The main problem for me was that the XML is not being extracted from the pdf.
If i extract the XML manually and insert it to your tool it is parsed correctly and i do have access to all the values.

The main problem for me was that the XML is not being extracted from the pdf.
I get an Exception for the invoice of mine.
ErrorException: Undefined variable $embeddedFile

in ZugferdDocumentPdfReader line 90

if (true == $attachmentFound) {
    /**
     * @var array<\Smalot\PdfParser\PDFObject>
     */
    $embeddedFiles = $pdfParsed->getObjectsByType('EmbeddedFile');
    foreach ($embeddedFiles as $embeddedFile) {
        if ($attachmentIndex == $embeddedFileIndex) {
            $returnValue = ZugferdDocumentReader::readAndGuessFromContent($embeddedFile->getContent());
            break;
        }
        $embeddedFileIndex++;
    }
}

Is this a problem you can help me to fix?

Kind regards

PS: i opened up a ticket in SMALOT / PDFParser:
smalot/pdfparser#740


The Field that the Validation Tool, you copied the result from, was correctly formed.
There can be the values "Information", "Group" or "Detail" for LineStatusReasonCode.

The Documentation can be downloaded here: https://www.awv-net.de/upload/ferd/ZF23_DE.zip

With the given examples there from, your library is working correctly.
But the Validation of the given examples by FERD do fail also.
So the fact that the Validation fails -> so your tool fails is not the cause.


@horstoeko
Copy link
Owner

Hi @PrimeGhostDE,

Is this a problem you can help me to fix?

No. This is not part of my library - I use a external lib

i opened up a ticket in SMALOT / PDFParser:

Very good.

So the fact that the Validation fails -> so your tool fails is not the cause.

????

I don't think we're getting anywhere here. Besides, we are now mixing up two completely different topics. I will close this issue now as I don't know how to help and can't provide a fix.

Kind regards

Repository owner locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants