3 Replies Latest reply on Jun 12, 2013 11:40 AM by Mike M

    Need Help Displaying Code128 Bar Code

    bake01 Level 1

      I have an ASP classic page were I can render a 3of9 bar code using Javascript where the bar code is rendered as an image.  I need to do the same thing using code128 but can't find a suitable script.  Does anyone have one they are willing to share?  I have Googled this to death!  Thanks in advance for any help!

        • 1. Re: Need Help Displaying Code128 Bar Code
          Mike M Level 6

          Apparently it can be done using Perl:


          And CPAN has an HTML Solution:


          I don't see that either of those renders as an image though.


          Is the image rendering an absolute requirement?

          • 2. Re: Need Help Displaying Code128 Bar Code
            bake01 Level 1

            Rendering the bar code as an image is an absolute requirement as it is a public-facing website.  I could render the bar code as a font easily enough but that would require the client to have that font installed, which is highly unlikely.  Thanks for taking the time to respond.

            • 3. Re: Need Help Displaying Code128 Bar Code
              Mike M Level 6

              From CPAN FAQs:

              Barcode::Code128 generates bar codes using the CODE 128 symbology. It can generate images in PNG or GIF format using the GD package, or it can generate a text string representing the barcode that you can render using some other technology if desired.

              The intended use of this module is to create a web page with a bar code on it, which can then be printed out and faxed or mailed to someone who will scan the bar code. The application which spurred its creation was an expense report tool, where the employee submitting the report would print out the web page and staple the receipts to it, and the Accounts Payable clerk would scan the bar code to indicate that the receipts were received.

              The default settings for this module produce a large image that can safely be FAXed several times and still scanned easily. If this requirement is not important you can generate smaller image using optional parameters, described below.

              If you wish to generate images with this module you must also have the GD module (written by Lincoln Stein, and available from CPAN) installed. Using the libgd library, GD can generate files in PNG (Portable Network Graphics) or GIF (Graphic Interchange Format) formats.

              Starting with version 1.20, and ending with 2.0.28 (released July 21st, 2004), GD and the underlying libgd library could not generate GIF files due to patent issues, but any modern version of libgd (since 2004) can do GIF as the patent has expired. Most browsers have no trouble with PNG files.

              In order to ensure you have a sufficiently modern installation of the GD module to do both GIF and PNG formats, we require version 2.18 of GD (which in turn requires libgd 2.0.28) or higher.

              If the GD module is not present, you can still use the module, but you will not be able to use its functions for generating images. You can use the barcode() method to get a string of "#" and " " (hash and space) characters, and use your own image-generating routine with that as input.

              To use the the GD module, you will need to install it along with this module. You can obtain it from the CPAN (Comprehensive Perl Archive Network) repository of your choice under the directory authors/id/LDS. Visit http://www.cpan.org/ for more information about CPAN. The GD home page is: http://stein.cshl.org/WWW/software/GD/GD.html


              I believe that is EXACTLY what you're looking for.