[Solved] How to add a barcode into invoice/quote template


First, upgrade MPDF library :

  • download current version at https://github.com/mpdf/mpdf

  • rename your current MDPF invoicePlane module vendor/mpdf to mpdf_BAK

  • upload new MDPF files into a vendor/mpd/mdpf folder

Edit your template file (here quote template application/views/quote_templates/pdf/InvoicePlane.php) by inserting a div tag (given sample is an alpha39 barcode with quote number) under <div id=“client”> :

	<?php echo '<div style="text-align:center;" class="barcodecell"><barcode code="'.$quote->quote_number.'" type="C39" class="barcode" />'; ?>
		<div style="text-align:center;"><?php echo trans('quote') . ' ' . $quote->quote_number; ?></div>

You can do additional changes into assets/invoiceplane/css/templates.css to improve rendering styles.

Other barcode samples can be found at https://github.com/mpdf/mpdf-examples/blob/master/example37_barcodes.php

InvoicePlane.php (7.7 KB)

Full quote template with barcode and other changes