Barcode Text contains characters that are not accepted by this barcode specification.

When attempting to generate a PdfCode128A barcode with the value "ABC-Test-1-4" (without the double quotes) the application throws an error: "Barcode Text contains characters that are not accepted by this barcode specification."

This is the code below:

PdfPage page = document.Pages.Add();
var barcodePosition = new PointF(100, 100));
PdfCode128ABarcode barcode = new PdfCode128ABarcode() { TextDisplayLocation = TextLocation.None };
barcode.Text = $"ABC-Test-1-4";
barcode.Size = new SizeF(printField.Width, printField.Height);
barcode.Draw(page, barcodePosition); // <-- error is thrown here


Using PdfCode128BBarcode doesn't have this issue.



2 Replies

KY Kit Yeo September 22, 2021 03:34 AM UTC

Have found the problem. PdfCode128A only support uppercase alphabets and not lowercase alphabets. Switching to PdfCode128B solves the problem. 



GK Gowthamraj Kumar Syncfusion Team September 22, 2021 09:37 AM UTC

Hi Kit Yeo, 

Thank you for contacting Syncfusion support. We are glad to know that your problem has been solved. 

Please refer the below documentation link for barcode supported types and associated valid characters. 

Regards, 
Gowthamraj K 


Loader.
Up arrow icon