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

Free Support Forum - aspose.com

Aspose.barCode in not reading the file in C#.net Core

Hi All,
CRN_4075002461_20210310_085032.pdf (175.8 KB)

We are using the following attached file, its a pdf first we are converting it to PNG file with the Help of Aspose.Pdf.pfdConverter with below mention height and width
then we are trying to read that png file to decode the text from QRCode attached in that PNG file , Can somebody help me what i did wrong here.

// Conversion
string asposeLicense = Configuration.ASPOSE_LICENSE_PATH;
                _logger.LogWarning("asposeLicense =" + asposeLicense);
                Aspose.Pdf.License pdflicense = new Aspose.Pdf.License();
                pdflicense.SetLicense(asposeLicense);
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(createdfilePath);
                int i = 1;
                foreach (var page in pdfDocument.Pages)
                {
                    string imagename = Guid.NewGuid().ToString();
                    string FilePath = createdImagePath + "\\" + imagename + i + ".png";
                    _logger.LogWarning("FilePath =" + FilePath);
                    //
                    // Create file stream for output image
                    using (FileStream imageStream = new FileStream(FilePath, FileMode.Create))
                    {
                        // Create Resolution object
                        Resolution resolution = new Resolution(3000);

                        // Create Png device with specified attributes
                        // Width, Height, Resolution
                        //PngDevice PngDevice = new PngDevice(1653, 2339, resolution);
                        PngDevice PngDevice = new PngDevice(1653, 2339);
                        PngDevice.Process(page, imageStream);

                        // Close stream
                        imageStream.Close();
                        ImagesInPdf.Add(FilePath);
                        _logger.LogWarning("ImagesInPdf =" + ImagesInPdf);

                    }
                }

//Reading 
 //Setting Aspose 
            string asposeLicense = Configuration.ASPOSE_LICENSE_PATH;
            Aspose.BarCode.License pdflicense = new Aspose.BarCode.License();
            pdflicense.SetLicense(asposeLicense);
            _logger.LogWarning("asposeLicense = "+ asposeLicense);
            try
            {
                foreach (var imagepath in Imagespaths)
                {
                    _logger.LogWarning("imagepath = " + imagepath);
                    using (BarCodeReader reader = new BarCodeReader(imagepath))
                         {
                            foreach (BarCodeResult result in reader.ReadBarCodes())
                            {
                                //Console.WriteLine("Type: " + result.CodeType + " QRCODE FOUND");
                                //Console.WriteLine("CodeText: " + result.CodeText);
                                string DecryptedString = result.CodeText;
                               _logger.LogWarning("DecryptedString = " + DecryptedString);
                               string[] findtheQrCodeisEinvoice = DecryptedString.Split('.').ToArray();
                                
                                if (findtheQrCodeisEinvoice.Length == 3)
                                {
                                    ValidQrCodeList.Add(DecryptedString);
                                }
                                else
                                {
                                    NotValidQrCodeList.Add(DecryptedString);
                                }
                            }
                        }

                        

                   // }
                }
               
            }

Deployed application in Linux server, its a .net core 3.1 application

@rahulcodepractise,
I have tried this scenario using the latest versions of Aspose.BarCode and Aspose.Pdf both. It is observed that the intermediate PNG file contains black box instead of the barcode image. Could you please share the intermediate PNG image file saved by your application for our reference? Here is the image that is generated at our end.

TestPDF.zip (1.4 KB)
Use pdf page rendering instead of image extracting

TestPDF.ExtractRenderedPDFPagesToFolder(@"d:\save\rec\pdf\CRN_4075002461_20210310_085032.pdf", -1, @"d:\save\rec\pdf\img\");

CRN_4075002461_20210310_085032.pdf (175.8 KB)
This is the file that contains the barcode

@rahulcodepractise,
I have tested this issue and seems that it is not an issue with the Aspose.BarCode API rather it is an issue with Aspose.PDF that is creating image from the PDF. I am moving this thread to the respective forum. You will soon get feedback about this issue.

@rahulcodepractise

We have logged an issue as PDFNET-50316 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Dear sir any update on this Part, As i am completely blocked due to this, As we are using Aspose.Total.lic and Aspose.pdf version is 20.7.0, Please help us to get the solution quickly if possible, because it is working for other pdf, only this type of PDF is keep getting struck. Thanks in Advance

@rahulcodepractise,
As this issue was recently logged so its pending for review. Please note that issues are resolved on first come first serve basis. We will write back here as soon as some progress is made in this regard.

thanks for an update