How to Generate PDF invoice to XML format using mPDF



PHP Snippet 1:

'PDFA' => true,
    'PDFAauto' => true,
    //'PDFAversion'=> 'A-3',
]);

$mpdf->SetAssociatedFiles([[
    'name' => 'public_filename.xml',
    'mime' => 'text/xml',
    'description' => 'some description',
    'AFRelationship' => 'Alternative',
    'path' => __DIR__ . '/TaxInvoice.xml'
]]);

$rdf  = '<rdf:Description rdf:about="" xmlns:zf="urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#">'."\n";
$rdf .= '  <zf:DocumentType>INVOICE</zf:DocumentType>'."\n";
$rdf .= '  <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>'."\n";
$rdf .= '  <zf:Version>1.0</zf:Version>'."\n";
$rdf .= '  <zf:ConformanceLevel>BASIC</zf:ConformanceLevel>'."\n";
$rdf .= '</rdf:Description>'."\n";

$mpdf->SetAdditionalXmpRdf($rdf);

PHP Snippet 2:

'PDFA' => true,
    'PDFAauto' => true,
    //'PDFAversion'=> 'A-3',
]);

$mpdf->SetAssociatedFiles([[
    'name' => 'thisisfilecreatedbympdf.xml',
    'mime' => 'text/xml',
    'description' => 'some description',
    'AFRelationship' => 'Alternative',
    'path' => __DIR__ . '/hereyourxmlinvoice.xml'
]]);