Jump to content

BarCode generator


This topic is 3630 days old. Please don't post here. Open a new topic instead.

Recommended Posts

For what it is worth, here is a code to create barcodes with ScriptMaster. It uses the barbecue library which can be downloaded here: http://barbecue.sourceforge.net/

Add the library to your jar list and there you go!


import java.io.File;



import net.sourceforge.barbecue.Barcode;

import net.sourceforge.barbecue.BarcodeFactory;

import net.sourceforge.barbecue.BarcodeImageHandler;



Barcode barcode = BarcodeFactory.createInt2of5(dataString);



//Uncomment those lines to save the barcode as a png

//File f = new File(destPath);

//BarcodeImageHandler.savePNG(barcode, f);



//Uncomment the following line to return the barcode as an image to FileMaker

BarcodeImageHandler.getImage(barcode);

  • Like 1
Link to comment
Share on other sites

Of course not B)-)

But this library actually allows you to create all kind of barcodes, maybe it is better to include the code39 barcode in the scriptmaster module as this is considered as the most standard barcode.

Edited by Guest
Link to comment
Share on other sites

  • 4 weeks later...

Jesse

A bit of extension to the above which gives more control of size and resolution


//

//



import net.sourceforge.barbecue.*

import java.awt.*

import java.awt.image.*





// change this to suit

font = new Font( "Arial" , Font.BOLD , 18)

barcode = BarcodeFactory.createCode39(barcode, true)

gw = barcode.getWidth()

// change this to suit if you want higher, default 50

//barcode.setBarHeight(70)

// this sets DPI

barcode.setResolution(200)

barcode.setFont(font)

gh = barcode.getHeight()

// change this if you want a coloured background

//image = new BufferedImage(t, s, BufferedImage.TYPE_INT_RGB)

image = new BufferedImage(gw, gh, BufferedImage.TYPE_BYTE_GRAY)

Graphics2D g2 = image.getGraphics()

// default is black so draw a white box first

// change type to INT_RGB if you want  a coloured background

g2.setColor(Color.white)

g2.fillRect(0,0,gw,gh)

barcode.draw(g2, 5, 0)

return image

Link to comment
Share on other sites

  • 2 years later...
  • 2 weeks later...
  • 11 months later...
  • Newbies

here i'd like to share some codes with you to help you create EAN-8 in project.

 

Dim reImage As REImage = REFile.OpenImageFile("c:/Sample.png", New PNGDecoder())
Dim barcode As New Linear()
'create a barcode
barcode.Type = BarcodeType.EAN8
'select barcode type
barcode.Data = "7777777"
'Enter a 7-digit data string
barcode.X = 1F
'set bar width
barcode.Y = 60F
'set bar height
barcode.Resolution = 96
'set resolution
barcode.Rotate = Rotate.Rotate0
'set rotate
barcode.DrawBarcode(reImage, 0, 0)
'draw barcode on REImage with location x and y
REFile.SaveImageFile(reImage, "c:/ean8.png", New PNGEncoder())

Link to comment
Share on other sites

  • 4 months later...
  • Newbies

Hi,

Barcode maker or generator is used to design professional barcode on Mac. This is basically used for business users which create number of colorful barcode in own style. This is used to generate and print barcode levels, tags on your Mac without having any technical knowledge. So use Barcode maker for Mac which is the bedst software to create or generate barcode labels.

Link to comment
Share on other sites

This topic is 3630 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.