{轉}使用cfmx 與 barcode 產生條碼

{轉}使用cfmx 與 barcode 產生條碼
出處﹕http://light.nimohost.com/blog/?p=148

--------------------------------------------------------------------------------

使用的是 Barbecue is an open-source http://barbecue.sourceforge.net/index.html
最新的版本是 barbecue-1.0.6b.zip 
Barbecue可以產生以下這些條碼
Code128 ,Code128A ,Code128B ,Code128C ,Code39 ,EAN128 ,
USPS , ShipmentIdentificationNumber ,SSCC18 ,SCCC14ShippingCode ,
GlobalTradeItemNumber ,UCC128 ,PDF417 ,3of9 ,USD3 ,Codabar
USD4 ,NW7 ,Monarch ,2of7

解開 barbecue-1.0.6b.zip 將 barbecue-1.0.6b.jar 放到
C:CfusionmxwwwrootWEB-INFlib 下  , CFMX 可能需要重新啟用

<cfscript>
myBarcodeobj = CreateObject("Java", "net.sourceforge.barbecue.Barcode");
myBarcodeFactory = CreateObject("Java", "net.sourceforge.barbecue.BarcodeFactory");
myBarcodeImageHandler = CreateObject("Java", "net.sourceforge.barbecue.BarcodeImageHandler");
myBarcodeobj=myBarcodeFactory.createCode128B("a12345890");
        Image = myBarcodeImageHandler.getImage(myBarcodeobj);
ImageIO = CreateObject("Java", "javax.imageio.ImageIO");
OutputStream = CreateObject("Java", "java.io.FileOutputStream");
OutputStream.init("C:\Cfusionmx\wwwroot\DEMO\test1.jpg");
ImageIO.write(Image, "jpg", OutputStream);
Image.flush();
OutputStream.close();
</cfscript>

<img scr="test1.jpg">

你可能感兴趣的:(java,C++,c,.net,C#)