GithubHelp home page GithubHelp logo

Extra 0 prepended to barcode about cli-barcode HOT 3 OPEN

tavinus avatar tavinus commented on June 25, 2024
Extra 0 prepended to barcode

from cli-barcode.

Comments (3)

tavinus avatar tavinus commented on June 25, 2024

Hi!
I wonder if this is running as Code_128C or not.

I know that those NEED to have even digits and zero is appended with the following code, for the Bar to be generated. This checks the length for MOD 2 (even number) and append the zero. What I find weird is that your example has already even number of digits.

// add trailling zero if odd digits on Code128C
$bc_string = strlen($bc_string) % 2 == 0 && $encoding === 'CODE_128_C'? 
    $bc_string : '0'.$bc_string;

If it is not here, then it is inside the Barcode generator code.
Yes, the problem was here, fix below

Can you please run it in verbose mode and post the output here? The zero is appended AFTER the value is printed, but may still help anyways. Testing with different string would also help (eg. 012345 12345 1234 etc). Just to see if the behavior is different.

I will make some testes here now.
Gus

from cli-barcode.

tavinus avatar tavinus commented on June 25, 2024

Ok, I think I found the problem. Fix is published here dce7413

I would use git though:

git clone https://github.com/tavinus/cli-barcode.git
cd cli-barcode
./barcode.php --create-bash
sudo make install

If already used git, it is easy to update with
(also no need to reinstall)

# run this inside the cli-barcode folder
git pull

Make sure you have the new version (1.0.8)

$ ./barcode --version
PHP-CLI Barcode v1.0.8

Please let me know if all went fine.
Thanks for posting the problem!
Gus

from cli-barcode.

tavinus avatar tavinus commented on June 25, 2024

BTW, This is meant for CLI (terminal, bash, etc)

If you are really using from PHP,
You should just use https://github.com/picqer/php-barcode-generator
and then you would also not need to run with exec or anything.

You can use my script as an example on how to implement your code.
But he also has examples and a good readme there.

If you want to make a script that runs with predefined parameters,
I recommend wrapping with a Bash script (instead of PHP).

Cheers!
Gus

from cli-barcode.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.