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

Free Support Forum - aspose.com

USPS OneCode Barcode

Can Aspose generate a USPS OneCode barcode from both the encoded 65 character string and the decoded 31 digit number value?

@dankick

You may generate barcode using the following code snippet:

string code = "1234567898745632145698745632145";
using (BarCodeGenerator barCodeGenerator = new BarCodeGenerator(EncodeTypes.OneCode, code))
{
    barCodeGenerator.Save(TestDirectory + "test.png", BarCodeImageFormat.Png);
}

The following code snippet could be used to read Barcode:

   BarCodeReader barCodeReader = new BarCodeReader(TestDirectory + "test.png", DecodeType.OneCode);
   while (barCodeReader.Read())
   {
                    Console.WriteLine("CodeText: " + barCodeReader.GetCodeText());
   }

Please feel free to write back to us if you having any further issue or if you need any additional information in this regard.

Thank you for this reply. Is it possible to use Aspose to decode a 65 encoded string like this into the 31 digit code?

DAFDTDAFFDFTDADTDDFTTFDTATATFFFDFTTFFFTFDDTDAAFATDFTFDFDTTTDTTFDA

@dankick

Thank you for your feedback.

Aspose.BarCode API throws invalid codetext exception with the string provided so we have logged this issue with ID “BARCODENET-37125” for further investigation. You will automatically be informed here once we have more information to share.

@dankick,
We have analyzed this issue and need feedback as mentioned below:
Note that BarcodeGenerator (even new one) doesn’t have the possibility to set already encoded text. One should set actual text and it will be encoded depending on chosen symbology. Could you please explain why the setting encoded text is a use case?

Currently, only “the decoded 31 digit number value” is supported.

Expected codetext is 20, 25, 29 or 31 digits.

However you can create user request about raw USPS OneCode encoding and we investigate necessity of changes.

I had to drop this issue previously, but I am coming back to it now. The reason for the use case is that my application is being provided the encoded text by another application. This was done as it was being then converted using a soft font on a printer when printing the document. We are trying to remove the need for the soft font by simply adding the barcode internally. We have reached out to the other team to see what it would take to provide us the un-encoded value instead.

@dankick,
Thank you for the feedback. We have recorded it with the ticket for our reference and will write back here once any feedback is ready to share.