Java BarCode dynamic sizing

Hi,

We have purchased a license for the Aspose Java BarCode component and are having real issues with trying to dynamically size the barcodes based on users settings. If the size is not specified then the barcodes prints to A4 fine and can be scanned. When trying to set the size manually this results in the barcode not sizing to fit the available label and as such is not a valid barcode.

I have tried playing with the setXdimension() but this seems to take a different value depending on the symbology used and doesn't seem to behave as expected. e.g. setting XDimension to a value of 0.6 makes it smaller but then going down to 0.4 the image get bigger!?

Is there any standard utility methods etc to allow the barcode to be generated dynamically based on unknown sizes/symbology/fonts etc. How should this XDimension figure be calculated at runtime?

Your Help is much appreciated.

Hi,


Thank you for inquiry.

The size of barcode image depends on the size of codetext and some other properties. Please refer to http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/ajusting-2d-images-size.html and http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/manage-xdimension-and-ydimension.html for more details.

If possible, please try to find out the maximum length of codetext and set the x and y dimensions so that the generated barcode fits on the label.

I had already seen the documentation and the problem is with knowing what to set the X dimension to given the size of the codetext? After spending quite some time on this and getting no where is it possible to get a refund on the licenses we have purchased as I suspect the barcode support in your product is not flexable enough for our requirements.

Hi,


We are very sorry for your inconvenience and investigating how to generate the barcode after automatically calculating x, y dimensions and other properties according to the codetext length and specified height and width of image. I have also logged this issue in our bug tracking system (ID: 24312). We will inform you here once it gets resolved.

If you want to get a refund, then please reply, I will move this thread to our Purchase forums. My colleagues there will help you in this matter.

Hi Rob,

We apologize for the inconvenience caused.

As mentioned by Saqib, we have logged this feature request in our Issue Tracking System. Once a feature request is logged into the Issue Tracking System, it is scheduled by our Development Team according to their plans. We are discussing this feature request with our Development Team Leader and will get back to you soon.

Have a nice day

Thank you for the updates I look forward to hearing your suggestions on how to acheive this barcode solution based on image size and different symbologies/codetext. Do you have any idea on timescales for a proposed solution to this issue?

Hi Rob,

Thanks for your reply.

As the issue has just been logged and it requires some investigation before sharing an ETA for the solution. Hopefully, we shall come up with the solution or a timeline for the solution by the start or mid of the next week. We shall keep you posted about the proceedings on our end.

Kind Regards

Hello Rob,

1. I'd attached a beta version of Aspose.BarCode for Java within this post.A new function called "public void preCheckSize()" was added to BarCodeBuilder class for checking the size setting. For example:

String file = "fixSize.png";
String code = "TestSizeTestSizeTestSizeTestSize";

BarCodeBuilder b = new BarCodeBuilder();
b.setSymbology(Symbology.CODE39STANDARD);
b.setCodeText(code);
b.setAutoSize(false);

b.setGraphicsUnit(GraphicsUnit.INCH);
Margins m = new Margins(0.2f,0.2f,0.2f,0.2f);
b.setMargins(m);
b.setXDimension(0.01f);
b.setBarHeight(0.5f);

float w = 7f;
float h = 1.0f;
b.setWidth(w);
b.setHeight(h);

try{
b.preCheckSize();
}
catch(BarCodeException ex)
{
System.out.println(ex.getMessage());
}

The above code snippet will print "Given height is too small,desired value is not less than 1.1458334."

2. For the issue of unexpected behavior of xDimension(setting XDimension to a value of 0.6 makes it smaller but then going down to 0.4 the image get bigger), it's because of the xDimension was reset once if the given value is too small to generate the barcode. In this beta version, it will throw BarCodeException with a message saying "xDimension is too small." for this case;

Please try this beta version and tell me if it's able to fit your requirement.

Thanks

Thanks for the change to throw the exception rather than defaulting back to a larger size but I am still unable to calculate the XDimension at runtime. Is there a utility method or even a mapping against which size image needs which XDimension based on the selected symbology and code text?

Hi,


We are investigating on this issue, to automatically set properties like x and y dimensions based on the codetext, symbology and specified size, to generate the barcode image equal or smaller than the specified size. I will get back to you with more information shortly. Sorry for the inconvenience.
RobGregory:

Thanks for the change to throw the exception rather than defaulting back to a larger size but I am still unable to calculate the XDimension at runtime. Is there a utility method or even a mapping against which size image needs which XDimension based on the selected symbology and code text?

Hi Rog,

We can provide a beta version to acquire the XDimension automatically next week.


Hi Rog,

Please try the attach beta jar, a new method “public void autoAssignSymbolSize()” was introduced into BarCodeBuilder class, below is the code sample:


BarCodeBuilder b = new BarCodeBuilder();

b.setSymbology(Symbology.CODE39STANDARD);

b.setCodeText(code);

b.setAutoSize(false);

b.setGraphicsUnit(GraphicsUnit.INCH);

Margins m = new Margins(0.2f, 0.2f, 0.1f, 0.1f);

b.setMargins(m);

float w =7.0f;

float h = 2.0f;

b.setWidth(w);

b.setHeight(h);

b.autoAssignSymbolSize();

b.save(file);
This method will calculate the most compatible values of xDimension and yDimension base upon the settings.

Thanks

Thank you for the modifications. I will try the attached and post some feedback once I get back onto the barcode printing project.


Rob

The issues you have found earlier (filed as 24357) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.