From bca4386aed7b60b76abecd4ec23dc9358a45090d Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Wed, 16 Sep 2015 21:56:57 +0100 Subject: [PATCH] Fix to sale and receiving receipt barcode --- application/libraries/Barcode_lib.php | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/application/libraries/Barcode_lib.php b/application/libraries/Barcode_lib.php index 85589e552..15ad86ac1 100644 --- a/application/libraries/Barcode_lib.php +++ b/application/libraries/Barcode_lib.php @@ -82,6 +82,34 @@ class Barcode_lib } } + public function generate_receipt_barcode($barcode_content) + { + try + { + // Code128 is used for the receipts + + $barcode = $this->get_barcode_instance(2); + + // set the receipt number to generate the barcode for + $barcode->setData($barcode_content); + + // image quality 100 + $barcode->setQuality(100); + + // width: 200, height: 30 + $barcode->setDimensions(200, 30); + + // draw the image + $barcode->draw(); + + return $barcode->base64(); + } + catch(Exception $e) + { + echo 'Caught exception: ', $e->getMessage(), "\n"; + } + } + public function generate_receipt_barcode($barcode_content) { try