Free Support Forum - aspose.com

Set barcode size to minimum

Hello,
We have a client who asked us to generate a Pdf417 barcode with the smallest dimensions as possible
I’m using Aspose.Barcode for .NET 4.0, version 18.1.0.0
And this piece of code :
{
Aspose.BarCode.License license = new Aspose.BarCode.License();
license.SetLicense(“Aspose.Total.lic”);
BarCodeBuilder barcodeBuilder = new BarCodeBuilder(barcode, EncodeTypes.Pdf417);
barcodeBuilder.CodeTextAlignment = System.Drawing.StringAlignment.Far;
barcodeBuilder.CodeLocation = CodeLocation.None;
barcodeBuilder.CodeTextFont = new System.Drawing.Font(barcodeBuilder.CodeTextFont.FontFamily, fontSize);
barcodeBuilder.Pdf417CompactionMode = Pdf417CompactionMode.Text;
barcodeBuilder.Pdf417ErrorLevel = Pdf417ErrorLevel.Level0;
barcodeBuilder.Pdf417Truncate = false;
barcodeBuilder.Margins.Set(0);
barcodeBuilder.CaptionBelow = new Caption() { Text = label, TextAlign = System.Drawing.StringAlignment.Far, Visible = true };
barcodeBuilder.GraphicsUnit = GraphicsUnit.Pixel;
return barcodeBuilder.GetCustomSizeBarCodeImage(width, height, false);
}

when I generate a label for text : 39980663|23550820||3765542|||||||||False|True|False|True||13/03/2020||1326734|
I get something like aspose_barcode2.png (3.6 KB)
If I set the barcode to be smaller, it gets hard to read (with a scanner). I played with AspectRatio, AutoSize, Rows but I didn’t get an acceptable result.

Our client send us a barcode generated for the same text: PDF417
If I compare this barcode with barcode generated with Aspose, I see that aspose barcode is more “complex”, it has more information on it I suppose.

My question is, what can I set to have a barcode with less extra info in it, so I can make it smaller and still to be very easy/fast to read ?

@trustteam,

Thanks for the sample code segment and details.

Well, since you are using an older version of Aspose.BarCode for .NET so we cannot evaluate your issue using older version. Neither we can fix any issue (if found) in older API, the fixes are only based on latest APIs set. Please note, we have enhanced rendering and reading barcodes modules in new versions using newer APIs set. We recommend you to kindly try our latest version (e.g Aspose.BarCode for .NET v20.3) with changed API. Please see the documents with examples for your reference on rendering and managing PDF417 barcodes with different option/attributes:
https://docs.aspose.com/display/barcodenet/PDF417+and+MacroPDF417+Barcode
https://docs.aspose.com/display/barcodenet/Managing+2D+Barcodes

If you still find any issue with Aspose.BarCode for .NET v20.3, kindly share your sample code with rendered barcode image, we will check it soon.