We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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


try {
} catch (Exception e1) {
// TODO Auto-generated catch block

	String GTIN = "123456789012";
	BarCodeBuilder builder =  new BarCodeBuilder();
	builder.setResolution(new Resolution(300f, 300f,ResolutionMode.Graphics));
	builder.setMargins(new MarginsF(2.97f,2.97f,0f,0f));
	try {
		builder.save("c:\\temp\\" + GTIN +".svg", BarCodeImageFormat.Svg);
	} catch (IOException e) {
		// TODO Auto-generated catch block


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)


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.



If we use :


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.


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.



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.



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.


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


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