Barcode UPC-A Height is not correct in 300X300 resolution

Hi ALl,

Please help me to set the correct height of UPC - A barcode. I am using the below code to populate the UPC-A

but the height is 34.925mm not 22.84mm i passed. II am using 18.6 java version

Thanks,

try {
validateLicensePath();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

	String GTIN = "123456789012";
	
	BarCodeBuilder builder =  new BarCodeBuilder();
	
	
	builder.setEncodeType(EncodeTypes.UPCA);
	
	builder.setBorderVisible(false);
	
	builder.setAutoSize(true);
	builder.setGraphicsUnit(GraphicsUnit.Millimeter);
	
	builder.setResolution(new Resolution(300f, 300f,ResolutionMode.Graphics));
	
	builder.setxDimension(0.33f);
	builder.setBarHeight(22.85f);
	//builder.setImageHeight(22.85f);
	builder.setCodeTextSpace(0.0f);
	builder.setSupplementSpace(0.0f);
	//builder.setyDimension(4.0f);
	builder.setMargins(new MarginsF(2.97f,2.97f,0f,0f));
	try {
		builder.setCodeText(GTIN);
		builder.save("c:\\temp\\" + GTIN +".svg", BarCodeImageFormat.Svg);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

@justinwang191,

Can you please also share a barcode image to show your expected output?

Thank you for the help . Attached the file now

the height actually is 109.714mm123456789012.pdf (80.4 KB)

@justinwang191,

Thanks for sharing the details. We will update you on this issue soon.

Any update in this one . I really need to print the barcode in the 300DPI with a correct barcode height.

Thnaks,

@justinwang191,

If we use :

builder.setCodeLocation(CodeLocation.None);

you will get exact height of the barcode as per your requirement. However, if codetext is added to the output, resultant image gets more height due to the inclusion of code text. However, height of the barcode still remains the same. At present, There is no such way to set exact size of barcode + codetext in the API using BarCodeBuilder. Future enhancements of the API, however, will provide such capability.

Thank you for the information however my problem is that if i set the resolution 300DPI , the height will be very big, if I set the resolution to 72DPI , the height is acceptable.

so my question how to set the acceptable height with 300*300DPI for svg format.

Thank you in advance for any help.

@justinwang191,

We are not able to reproduce this issue at our end. GIMP image (1).png (13.2 KB)
and Windows Previewerimage.png (10.2 KB)
show the same height as specified in the code. These images are taken by setting codetext location to None.

The image is very good. Would you please post the code ? so i can compare it with my code.

Thanks,

@justinwang191,

We have used your above code with additional line of code we have mentioned above with option of CodeLocation.None. Output SVG and PNG outputs are attached here for reference. If you open these with GIMP, you will see the same height in mm as set by application code. 123456789012.zip (1.2 KB)

The height is correct in GIMP, but not correct in Adobe Illustrator.

Thanks,

@justinwang191,

The upcoming version of Aspose.Barcode for Java 18.7 is going to introduce a new Barcode Generator class that gives you more control over the size of Barcode generation. We request you to wait for its availability (which is due in this week) to check it out.

Hi ,

Wonderful. Can not waiting to see this.

Regards,

Can you point me where I can get the 18.7 release note? thanks

@justinwang191,

You can find details about Release Notes of this new version here.