Code 128 Barcode Width in Java

topics related to linear barcode formats such as Code 39, Code128, Interleaved 2 of 5 (ITF25), UCC/EAN-128, UPC-A, UPC-E, EAN-13, EAN-8, GS1 Databar etc.

Code 128 Barcode Width in Java

Postby candysmith on Mon May 28, 2012 11:49 pm

Hi, all,
The width of Code 128 generated in Java application is much larger than the printing space I have on the label. Even setting the bar width to 1 pixel also cannot meet my requirement. I tried to scale the Code 128 barcode image but no result happened. Is there any way to further reduce the width of the Code 128 barcode image in my Java application?
candysmith
 
Posts: 2
Joined: Wed May 23, 2012 12:13 am

Re: Code 128 Barcode Width in Java

Postby David_3 on Tue May 29, 2012 5:02 am

It comes down to the resolution of your printer. If you set the bar width to be 1 pixel and produce the barcode too large, then you scan try and scale. But the generated barcode image will be not clear. A printer needs at least 300 dpi barcode.
David_3
 
Posts: 1
Joined: Fri May 25, 2012 6:00 am

Re: Code 128 Barcode Width in Java

Postby glitch on Tue May 29, 2012 12:42 pm

How did you print the barcode image?

If you are printing a raster image, scaling will happen otherwise you should get a small barcode on a printer - because printer resolution is usually much higher than screen. If you print pixel-to-pixel, scaling 5 times (96 dpi -> 600 dpi) give you approximately the same size as laid out at screen.

For highest quality possible, consider using code128 fonts instead: http://www.morovia.com/fonts/code128/.
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Re: Code 128 Barcode Width in Java

Postby candysmith on Wed May 30, 2012 12:28 am

David_3 wrote:It comes down to the resolution of your printer. If you set the bar width to be 1 pixel and produce the barcode too large, then you scan try and scale. But the generated barcode image will be not clear. A printer needs at least 300 dpi barcode.
So you mean to call barcode.setResolution(300), that is ok? I just have a try and it really reduce the barcode width. The generated barcode image seems merging some bars on the screen, but is clearly separated on zooming. But I don’t know what the result on the printer and scanner is?
candysmith
 
Posts: 2
Joined: Wed May 23, 2012 12:13 am


Return to Linear symbologies

Who is online

Users browsing this forum: No registered users and 0 guests