Skip to main content
Inspiring
January 30, 2008
Question

Free barcode generator?

  • January 30, 2008
  • 7 replies
  • 12123 views
Does anyone know of a free or 'cheap' barcode generator that will work with
CF?


    This topic has been closed for replies.

    7 replies

    BKBK
    Community Expert
    Community Expert
    April 20, 2012

    Newsgroup_User wrote:

    Does anyone know of a free or 'cheap' barcode generator that will work with CF?

    Hello one and all,

    ColdFusion can go even one better. You can use the iText library, which currently ships with ColdFusion, to generate barcodes!

    Here is a proof of concept:

    <cfscript>

    codeEAN = createobject("java","com.lowagie.text.pdf.BarcodeEAN");

    codeEAN.setCodeType(codeEAN.EAN13);

    codeEAN.setCode("4902555131719");

    color =  createobject("java","java.awt.Color");

    image = codeEAN.createAwtImage(color.black, color.white);

    bufferedImage = createObject("java", "java.awt.image.BufferedImage");

    bufferedImageType = bufferedImage.TYPE_BYTE_GRAY;

    bufferedImage = bufferedImage.init(image.getWidth(JavaCast("null", "")),image.getHeight(JavaCast("null", "")), bufferedImageType);

    graphics2D = bufferedImage.createGraphics();

    graphics2D.drawImage(image,0,0,JavaCast("null", ""));

    barcodeImage = imageNew(bufferedImage);

    </cfscript>

    <cfimage action="writeToBrowser" source="#barcodeImage#" format="jpg">

    Inspiring
    April 20, 2012

    Nice job!  One shortcut you could add is grabbing the graphics object from the CF image instead of creating a new bufferedImage (slight savings). That is a trick I have used in the past:

    ie     ...

            width  = image.getWidth(JavaCast("null", ""));

            height = image.getHeight(JavaCast("null", ""));

            cfImage = imageNew("", width, height);

            graphics = ImageGetBufferedImage(cfImage).getGraphics();

            graphics.drawImage(image,0,0,JavaCast("null", ""));

    BKBK
    Community Expert
    Community Expert
    April 12, 2012

    Newsgroup_User wrote:

    Does anyone know of a free or 'cheap' barcode generator that will work with CF?

    Barbecue.

    Participant
    April 12, 2012

    also im found Code 128 fully functional barcode generator http://www.mbcestore.com.mx/generador/codigo-de-barras/, just linked to my webservice/CFapp and im request string and return image with barcode very usefull

    February 1, 2008
    You may be able to get away with Code 39 font at http://www.barcodesinc.com/free-barcode-font/
    Inspiring
    January 31, 2008
    Looks like that is all about making charts? Where is something about
    generating barcodes?

    "natg504" <webforumsuser@macromedia.com> wrote in message
    news:fnsjfp$sv$1@forums.macromedia.com...
    > http://www.fusioncharts.com/free/


    Inspiring
    January 31, 2008
    January 30, 2008