To Test Barcode Case.pdf (755.8 KB)
Hi Team,
we not able to read barcode from attached file. we used
Aspose Barcode Version : 22.5
Aspose Pdf Version : 21.3
Aspose Word Version : 21.9
Below code
MemoryStream stream1 = new MemoryStream(documentA.doc);
Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document(stream1);
Int32 BarcodeCount1 = 0;
List<String> barcode_list1 = new List<string>();
Aspose.Pdf.Facades.PdfExtractor pdfExtractor1 = new Aspose.Pdf.Facades.PdfExtractor();
pdfExtractor1.BindPdf(stream1);
pdfExtractor1.ExtractImage();
while (pdfExtractor1.HasNextImage())
{
MemoryStream imageStream1 = new MemoryStream();
pdfExtractor1.GetNextImage(imageStream1);
using (BarCodeReader reader = new BarCodeReader(imageStream1, DecodeType.Code39Standard))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
BarcodeCount1++;
barcode_list1.Add(result.CodeText);
}
}
}
Issue : We are unable to read barcode in attached document using above code.
Barcode was generated, using aspose as well
Code to add Barcode :
Code39 code = new Code39(Guid.NewGuid().ToString().ToUpper());
byteArrayBarcode = code.Paint();
System.IO.MemoryStream ms = new System.IO.MemoryStream(byteArrayBarcode);
ImageStamp img = new ImageStamp(ms);
//img.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/" + ".png");
img.HorizontalAlignment = HorizontalAlignment.Left;
img.VerticalAlignment = VerticalAlignment.Bottom;
img.LeftMargin = 70;
img.BottomMargin = 8;
img.Background = true;
img.XIndent = 200;
img.YIndent = 150;
img.Height = 30;
img.Width = 200;
errorCounter = 20;
Random random = new Random();
img.setStampId(random.Next(int.MaxValue));
Aspose.Pdf.Document document2 = new Aspose.Pdf.Document(filePath);
for (int page = 1; page <= document2.Pages.Count; page++)
{
PageCollection pagecollection = document2.Pages;
pagecollection[page].AddStamp(img);
}
// Save updated PDF file
document2.Save(filePath);