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
Be Factur-x ready #3443
Milestone
Comments
I managed to embed a Factur-x xml file Using https://github.com/easybill/zugferd-php $result = DocumentGeneratorService::generate($command);
$pdf = InvoiceServiceImpl::htmlToPDF($result);
$canvas = $pdf->getCanvas();
$facturXFile = '';
if ($canvas instanceof CPDF) {
$doc = new CrossIndustryInvoice();
$ctx = $doc->exchangedDocumentContext = new ExchangedDocumentContext();
$ctx->documentContextParameter = DocumentContextParameter::create('urn:factur-x.eu:1p0:minimum');
$echDoc = $doc->exchangedDocument = new ExchangedDocument();
$echDoc->id = 'F-0000001';// TODO: change me
// See: https://communaute.chorus-pro.gouv.fr/wp-content/uploads/2017/07/Specifications_Externes_Annexe_EDI_V4.22.pdf
// See: https://www.billygen.fr/publications/comprendre-factur-x-part2/
// 380 : Facture commerciale
// 381 : Avoir (note de crédit)
// 384 : Facture rectificative
// 389 : Facture d'autofacturation (créée par l'acheteur pour le compte du fournisseur). Code non accepté pour ChorusPro
// 261 : Avoir d'autofacturation. Code non accepté pour Chorus Pro
// 386 : Facture d'acompte
// 751 : Informations de facture pour comptabilisation : code exigé en Allemagne pour satisfaire ses contraintes réglementaires. Code non accepté pour Chorus Pro.
$echDoc->typeCode = '380';// TODO: change me
$echDoc->languageId = ['FR'];// TODO: change me
$echDoc->issueDateTime = new DateTime('now');// TODO: change me
$xml = Builder::create()->transform($doc);
$facturXFile = tempnam(sys_get_temp_dir(), 'factur-x');
file_put_contents($facturXFile, $xml);
$canvas->get_cpdf()->addEmbeddedFile(
filepath: $facturXFile,
embeddedFilename: 'factur-x.xml',
description: 'Factur-X XML file'
);
}
$output = $pdf->output();
unlink($facturXFile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is Factur-x ?
related tools:
Related issue on TCPDF: tecnickcom/TCPDF#578 (no progress)
cc @Starfox64
Using the work from #3269 for PDF/A
Currently this are the errors I have to solve (https://services.fnfe-mpe.org):
Vera PDF only reports: Specification: ISO 19005-3:2012, Clause: 6.2.11.4.1, Test number: 1
The text was updated successfully, but these errors were encountered: