newsPHP code128 barcode - News: Version 0.61: Stay in code C when 2 digits remaining

 
 
Latest News
Version 0.61: Stay in code C when 2 digits remaining posted by harding, Sat 10 Nov 2007 01:45:55 PM UTC - 1 reply
CVS Update: can now encode a single character posted by harding, Wed 08 Aug 2007 01:29:50 PM UTC - 0 replies
[Submit News]
[2 news in archive]

Version 0.61: Stay in code C when 2 digits remaining

Item posted by Thomas Harding <harding> on Sat 10 Nov 2007 01:45:55 PM UTC.

Thanks to Sonia Heimann, who found the bug and
proposed a new algo.

Versions note:
2 new public variables:

* $this->unoptimized to set to true if you
experience problems with "laposte colissimo" barcode;
* $this->nozerofill to disable trailing and leading zeros
(then it's up to you to manage blank zones)

Comments:

la Poste barcodes, additional information (posted by Sonia Heimann, Mon 12 Nov 2007 10:47:24 AM UTC)

It seems that for La Poste barcodes you have to encode the 3 first characters with CODEB then the 10 last chars in CODEC

// $cab is like NL NNN NNN NNNN N
// sample 1J 450 345 0075 1
// code neede CC CBB BBB BBBB B

So I splitted the cab string in 2 substrings, forcing the parser to process them independantly

$cab = "1J45034500751";
$code_b = substr($cab, 0, 3); // sample 1J4
$code_c = substr($cab, 3); // sample 5034500751

$code = $barcode->output(array($code_b, $code_c));

So the first batch of 3 characters is processed as B code due to the letter in it, and the last batch of 10 digits is processed as C code thanks to the new library version.

I did not need to change $barcode->unoptimized.

Again, thank you for this very useful library !


   

 

Back to the top


Powered by Savane 3.1-cleanup