Skip to main content
Inspiring
Jan 30, 2008 8:45 PM UTC
Question

Free barcode generator?

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


    This topic is closed to new replies. Start a new post to keep the conversation going.

    20 replies

    BKBK
    Community Expert
    Community Expert
    Apr 20, 2012 11:28 AM UTC

    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">

    Translate
    Inspiring
    Apr 20, 2012 3:56 PM UTC

    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", ""));

    Translate
    BKBK
    Community Expert
    Community Expert
    Apr 12, 2012 6:49 PM UTC

    Newsgroup_User wrote:

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

    Barbecue.

    Translate
    Participant
    Apr 12, 2012 5:38 PM UTC

    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

    Translate
    Feb 1, 2008 5:53 PM UTC
    You may be able to get away with Code 39 font at http://www.barcodesinc.com/free-barcode-font/
    Translate
    Inspiring
    Jan 31, 2008 10:09 PM UTC
    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/


    Translate
    Inspiring
    Jan 31, 2008 1:46 PM UTC
    Jan 30, 2008 9:09 PM UTC