Issue with PDF417 barcode with .net API

Hi Team,

I am Evaluating ASPOSE .net bar-code API to generate PDF 417 and Code39 bar-code.

PDF 417 bar-code is not getting detected by Kofax client when i draw image using windows graphics object or even with bar-code print function if I change resolution.

Also facing a lot of issues while resizing the images as well.

  1. PDF 417 bar-code is not detected by Kofax client.

Below is the code I am using to generate PDF 417:

BarCodeBuilder myBarcode = new BarCodeBuilder();
myBarcode.EncodeType = EncodeTypes.Code39Standard;
myBarcode.CodeText = “PIDX0082017100100000000PIDX”;
//dpi is 600
myBarcode.Resolution = new Resolution(gfx.DpiX, gfx.DpiY, ResolutionMode.Graphics);
myBarcode.CodeText = “PI2DXD_TEST DRESR INDEX 20170103 PI2DX”;
Bitmap bmp = myBarcode.GetOnlyBarCodeImage();
myBarcode.Save(“3Dbar.bmp”); //this saved image is detected by barcode reader

Bitmap bmp1 = myBarcode.GetCustomSizeBarCodeImage(PixelToMM(bmp.Width, gfx.DpiY) * 5, PixelToMM(bmp.Height, gfx.DpiY) * 5, false);

gfx.DrawImage(bmp1, 10, 10); // this is not detected. this one I am drawing on the page. (i tried changing graphics unit to milimeter as well)

I have uploaded image file(detected) and PDF(not detected) printed.

  1. even with barcode.print function if i change resolution barcode stops getting detected.

  2. when we use print function of barcode can we provide the co-ordinate of the page where we want to print the barcode?

  3. Please let me know the error handling mechanism in ASPOSE library.

Thanks in advance for your help.BarcodeUsingDraImage_notDetected.pdf (7.2 KB)
BarcodeUsingDraImage_notDetected.pdf (7.2 KB)
BarcodeImage_Detected.jpg (14.2 KB)

@amit.raghuvanshi,

We have investigated the issue at our end by generating the barcode images using the code snippet shared by you. PDF files were generated using the barcode images. Aspose.BarCode APIs were able to recognize the barcode from images and PDF files. Furthermore, the generated barcode images were supplied to several online barcode readers. They too are able to recognize the barcodes. Sample barcode images and PDF file are attached for your reference.

It is therefore requested that a complete sample project be shared to reproduce the issue. We will evaluate it and update you about our findings.
MyBarCode_out.zip (159.2 KB)

@ikram.haq

Thanks for the quick response it seems that I have copied wrong encoded type i.e. code39
myBarcode.EncodeType = EncodeTypes.Code39Standard;.

But as I have already mentioned in my post that I am facing issue with PDF417 barocde.

Please change myBarcode.EncodeType to EncodeTypes.Pdf417.

@amit.raghuvanshi,

We have investigated the issue by generating the with PDF417 coded barcode images. PDF files were generated using the same barcode images. It was found that Aspose.BarCode APIs were able to recognize the barcode from images and PDF files. Furthermore, the generated barcode images were supplied to several online barcode readers. They too are able to recognize the barcodes. Sample barcode images and PDF file are attached for your reference.
sample_Pdf417_160469.zip (389.5 KB)

@ikram.haq,

Thanks for the response.

With the same piece of code PDF generated by me are not getting detected by online barcode reader, I have attached the same.

I am generating PDF in 600 DPI in print event, are you generating barcodes with same DPI settings using graphics draw method?

Not sure what I am doing wrong.

Will it be possible for you to share your code snippet.Test.pdf (5.8 KB)

We are able to read the barcode from PDF file successfully using Aspose.BarCode. Furthermore, the barcode was supplied to several online barcode readers. They too are able to recognize the barcode. Sample code snippet is attached for your reference.

Result:
Codetext found: PI2DXD_TEST DRESR INDEX 20170103 PI2DX, Symbology: Pdf417
code_snippet.zip (1.7 KB)

@ikram.haq,

Thanks for the response.

As per your code snippet you are first creating the Bar-code using ASPOSE bar-code library and then creating a PDF using ASPOSE PDF library.
After that you embed bar-code into PDF. However in my case i am generating bar-code using ASPOSE library in print event of .net and using draw method of graphics class.

so first question is if I buy license of ASPOSE bar-code product family will I be able to use PDF as well?

For your reference please find attached my code built in VS 2015.tempCodeSnippet.zip (1.3 MB)

@amit.raghuvanshi,

We have evaluated the sample project shared by you. The generated barcode images and PDF file are attached for your reference. We are able to read the barcode successfully. The PDF file was generated by a 3rd party not by Aspose.Pdf. Furthermore, the barcode images were supplied to several online barcode readers. They too are able to recognize the barcode.
test_barcode_160469.zip (326.1 KB)

@ikram.haq,

Thanks for your response.

PDF shared by you are working for me as well.

did you do any changes in my code prior generating the bar-code.

Is there any width * height ratio that needs to be maintained for PDF417 barcode.

@amit.raghuvanshi,

This is to update you that we haven’t changed any thing in the code. The only change was the path to license file and barcode images path. After these changes we simply executed the project and selected one of the installed printers from the list and generated the PDF file.

@ikram.haq

Is there any width * height ratio that needs to be maintained for PDF417 barcode.

because I observed when i change it sometimes its not getting detected.

@amit.raghuvanshi,

Yes, there is a need to have a proper height to width ratio for barcode detection. Please visit the link AspectRatio Property for details. Note that xDimension & yDimension properties only affect 1D barcodes. AspectRatio property affects the 2D barcodes e.g. PDF417. If we set custom Width & Height we must set the AutoSize property to false. If AutoSize is true, then size of barcode depends on x/yDimension (in case of 1D barcode) and depends on AspectRatio (in case of 2D).