when i include a SVG file into my pdf to create my barcode by using either of the following:
$pdfString = $this->mpdf->Output('FilenameIsIgnored', 'S'); (used when i email vouchers) $this->mpdf->Output($pdf_filename, 'I');(used when i want to display voucher on screen)I get the following result:

As you can see it adds the following visible text <?xml version="1.0" standalone="no" ?> and it should not be doing this.
Notes
This is the file order
I will add a cut down version of the code here
<?php
/** print.php **/
// Generate the barcode (as html)
$bc_generator = new Picqer\Barcode\BarcodeGeneratorSVG();
$voucher_barcode = $bc_generator->getBarcode($this->app->components->voucher->getRecord(\CMSApplication::$VAR['voucher_id'], 'voucher_code'), $bc_generator::TYPE_CODE_128);
// Assign barcode to smarty
$this->app->smarty->assign('voucher_barcode', $voucher_barcode );
// Specify what action to do (pdf in browser)
$this->app->system->communication->performAction(\CMSApplication::$VAR['commType'], $templateFile, null, $filename ?? null, $client_details ?? null, $emailSubject ?? null, $emailBody ?? null);
/** Communication.php **/
// fetch the smarty template as a string
$this->templatePayload = $this->app->smarty->fetch($templateFile);
/** Pdf.php **/
// Send the template as a pdf to the browser
$this->app->system->pdf->mpdfOutputBrowser($this->filename.'.pdf', $this->templatePayload);
````html
![]() |
| My Name |
|
Purchased by my name |
| £100.00 |
Thanks for any help shoulders All 2 commentsYou need to include the resulting html that you are trying to convert, preferably the minimum required to reproduce the issue. This is a bug, mPDF should ignore the xml declaration. Currently, until fixed, you have a few options:
Was this page helpful?
0 / 5 - 0 ratings
Related issues |