# How to include customer BARCODE on Invoice

**URL:** <https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033>\
**Category:** Using my Dolibarr\
**Created:** [October 19, 2018, 9:20am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033 "2018-10-19T09:20:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![magumane](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@magumane](https://www.dolibarr.org/forum/u/magumane)\
**Post date:** [October 19, 2018, 9:20am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/1 "2018-10-19T09:20:29Z")

</div>

Hi Dolibarr enthusiastics!

How do you add the third party barcode on documents (proposals, Invoices, Shipment Notes, etc)?

Apprciated!

---

<div class="post-metadata">

**Author:** ![grandoc](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/grandoc/32/24_2.png) [@grandoc](https://www.dolibarr.org/forum/u/grandoc)\
**Post date:** [October 19, 2018, 9:42am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/2 "2018-10-19T09:42:44Z")

</div>

Hi  
You can do it with the module [ultimatepdf](https://www.dolistore.com/en/modules/999-ultimatepdf-80.html)  
I create an example  
Regards  
Philippe

[PR1007-0002.pdf](https://www.dolibarr.org/forum/uploads/short-url/rpSHEVZEhwTmkCor7xqu1E1vn80.pdf) (13 KB)

---

<div class="post-metadata">

**Author:** ![magumane](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@magumane](https://www.dolibarr.org/forum/u/magumane)\
**Post date:** [October 19, 2018, 2:59pm UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/3 "2018-10-19T14:59:55Z")

</div>

Hi grandoc,

thank you fro your suggestion. I was wondering whether this can be natively (without use of external modules), and, I wanted to add the BARCODE of the Third Party (Customer) not that of the product!

Thank you

---

<div class="post-metadata">

**Author:** ![grandoc](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/grandoc/32/24_2.png) [@grandoc](https://www.dolibarr.org/forum/u/grandoc)\
**Post date:** [October 20, 2018, 2:59pm UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/4 "2018-10-20T14:59:21Z")

</div>

Hi  
ultimatepdf can do it also. It works for barecode and QRcode

[PROV238.pdf](https://www.dolibarr.org/forum/uploads/short-url/3pCdaPmNZzRgxzuTtGmVQHEliTB.pdf) (18 KB)  
regards

Philippe

---

<div class="post-metadata">

**Author:** ![GhanshyamParmar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/ghanshyamparmar/32/9018_2.png) [@GhanshyamParmar](https://www.dolibarr.org/forum/u/GhanshyamParmar)\
**Post date:** [November 25, 2025, 8:16am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/5 "2025-11-25T08:16:49Z")

</div>

find this code

// Description of product line  
if ($this-\>getColumnStatus(‘desc’)) {  
if ($object-\>lines[$i]-\>special\_code != SUBTOTALS\_SPECIAL\_CODE) {  
$this-\>printColDescContent($pdf, $curY, ‘desc’, $object, $i, $outputlangs, $hideref, $hidedesc);  
$this-\>setAfterColsLinePositionsData(‘desc’, $pdf-\>GetY(), $pdf-\>getPage());

after this add

if (!getDolGlobalString(‘MAIN\_GENERATE\_DOCUMENTS\_SHOW\_PRODUCT\_BARCODE’) && !empty($this-\>getBarcode($object-\>lines[$i]-\>fk\_product))) {  
$code = $this-\>getBarcode($object-\>lines[$i]-\>fk\_product);  
$barcodeType = ‘C128’;  
$pdf-\>setXY($this-\>getColumnContentXStart(‘desc’),$curY + 15);  
//$pdf-\>write2DBarcode($code, ‘QRCODE,M’, $this-\>getColumnContentXStart(‘desc’) , $curY + 15, 20, 20, $styleQr, ‘N’);  
$pdf-\>write1DBarcode($code, $barcodeType, $this-\>getColumnContentXStart(‘desc’) , $curY + 13, 70, 10, 0.4, array(‘position’=\>‘S’, ‘border’=\>false, ‘padding’=\>1, ‘fgcolor’=\>array(0,0,0), ‘text’=\>false, ‘font’=\>‘helvetica’, ‘fontsize’=\>8, ‘stretchtext’=\>2), ‘N’);  
$this-\>setAfterColsLinePositionsData(‘desc’, $nexY, $pdf-\>getPage());  
$this-\>setAfterColsLinePositionsData(‘desc’, $pdf-\>GetY(), $pdf-\>getPage());  
}

and place this code to get product barcode data outside this function

```auto
public function getBarcode($id)
	{
	$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product";
	$sql .= " WHERE rowid = ".((int) $id);
	dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
	$resql = $this->db->query($sql);
	if ($resql) {
		$row = $this->db->fetch_row($resql);
		$result = $row[0];
		}
	return $result;
	}

```

 ![image](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/f/fa27ecd2c7c0a6092d1f064a6c2257d1f6af4d0c.png)
