Jump to content

Recommended Posts

  • 4 weeks later...
  • 7 months later...

hi

 

PrestaShop uses the TCPDF library to generate PDF invoices. Barcodes are basically like other text but printed through a "barcode" font, not letters. That is all.

i bought the module, its working but it generating an extra digit and also a ">" behind every barcode. and i cant scan it properly. how do it solve it thanks

Link to comment
Share on other sites

  • 7 months later...

PrestaShop uses the TCPDF library to generate PDF invoices. Barcodes are basically like other text but printed through a "barcode" font, not letters. That is all.

 

Hey,

 

im trying to show barcode at invoice footer but got this result: http://prntscr.com/6lwpfv

 

$barcodeobj = new TCPDFBarcode('http://www.myshop.eu' 'C128');

 

$barcod = $barcodeobj->getBarcodeHTML(2, 30, 'black');

 

and assign barcod to variables in HTMLTemplate.php getFooter function. What Did I do wrong? Thanks man!

Link to comment
Share on other sites

Sorry, I never used TCPDFBarcode class. I have simple <barcode> tags in my templates, but those don't use TCPDF library.

Mh, If I check the value with var_dump($barcod) I got correct bar code. And then add in footer {$barcod} I see only line like <hr />. So strange..

Link to comment
Share on other sites

  • 1 month later...

Hey, Ive changed my mind and using generated barcode in picture, but after all I commented a few lines maybe it helps u.

 

  $this->write1DBarcode('www.site.com', 'C39+', '', '', 20, 10, 0.4, $style, 'N');

 

It works , check write1DBarcode function details.
 

Link to comment
Share on other sites

Hello, thank you for the reply

 

I am using a tpl template to generate pdf and using this code:

 

$pdf = new PDF($this->boxes, PDF::TEMPLATE_AIRWAY,Context::getContext()->smarty);
$pdf->render(true);
 
This is how i generate barcode:
 
$tcpdfbarcode = new TCPDFBarcode($order->getUniqReference(), EAN13);
$bar = $tcpdfbarcode->getBarcodePNG(2, 30, array(0,0,0) );
 
and i assign the $bar to smarty data so i can print them in tpl template.
 
Can you tell me how can i add this to smarty ?
 
Thank you
Link to comment
Share on other sites

This is how I added barcodes to templates, with no need to change any php code. 

 

For yours, $bar has a png image in it.  You might be able to do something like

 

$smarty->assign('bar', base64_encode($bar));

 

then in the template

 
<img src="data:image/png;base64,{$bar}" alt="barcode">
 
But I haven't tested that at all!
Link to comment
Share on other sites

×
×
  • Create New...