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

Free Support Forum - aspose.com


I'm trying to generate a Pharmacode barcode using the Java API. The calls appear to work and a file gets written when I do save, but the image generated looks like a dummy - the data is A123456. I have tried using setCodeText with both a string and a byte array.

It looks like Pharmacode generation support was added in 5.0, so I assume I am doing something wrong.

BarCodeBuilder builder = new BarCodeBuilder();
byte [] bytes = new byte[3];
// String txt = "333";
bytes[0] = bytes[1] = bytes[2] = (byte)3;
// builder.setCodeText(txt);
// set symbology type
// save the image to file

Hi Mark,

Thank you for contacting support. I tested your source code against the latest build of Aspose.BarCode for 5.4.2 and managed to replicate the problem. I have logged this issue under ticket id BARCODJAVA-33400 in our issue tracking system. Your request has also been linked to this issue and you will be notified as soon as it is fixed. We are sorry for your inconvenience.

Is there a workaround in the meantime?

Hi Mark,

Thanks for your inquiry. I would like to clarify that you can encode/decode pharma code symbology in a correct way. Furthermore, I logged this issue in the perspective of incorrect appearance of code text i.e. A333 instead of 333 etc. Our development team is looking into the matter. I shall let you know once a significant move has been made.

I hope it helps. Please do let me know in case of any confusion or questions.

Yes, using setCodeText(String) does work. Also, setCodeLocation(CodeLocation.None) removes the human readable. We also confirmed with our verifier that the generated barcodes work.

It appears that currently, data is truncated if it exceeds what the barcode accepts. It would be nice to have a mode where this threw an exception instead of just "succeeding".

Thanks for the prompt response - looks like you guys have a great support operation.


Hi Mark,

Thanks for your inquiry. Could you please share any such code example where you think data is truncated? We shall take a closer look and guide you accordingly.

If you run the code below, you will get 2 identical pharamcode barcodes. In fact, the value provided to setCodeText is invalid - pharmacode only encodes 3 to 131070.

String strImagePath = "c:\\temp\\pharma\\pharm1.jpg";
String strImagePath2 = "c:\\temp\\pharma\\pharm2.jpg";
String txt = "9999999999";
String txt2 = "9999999998";
BarCodeBuilder builder = new BarCodeBuilder();

builder = new BarCodeBuilder();

Hi Mark,

Thank you for these details. I already have logged an issue to raise a proper error message when exceeding code text of pharma code symbology. It is logged under ticket id BARCODJAVA-33401 in our issue tracking system. Your request has also been linked to this and you will be notified as soon as it is fixed. We’re sorry for your inconvenience.

Hi Mark,

Thank you for being patient. We have a good news for you that the issue ids BARCODJAVA-33400 and BARCODJAVA-33401 have now been resolved. If there is no issue in the QA phase, then their fixes will be included in the next version of Aspose.BarCode for Java 6.9.0. We’ll inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as BARCODJAVA-33401;BARCODJAVA-33400) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.