Quantcast
Viewing all 333 articles
Browse latest View live

Alltime Barcode Caption showing with Rotate issue

I am creating Aspose barcode and later its inserting into a pdf page . But all the time its displaying as wrong rotated level. image attached. Please help. Code added below

Private Sub UpdateDocument(ByVal lst As List(Of String))

       
        Dim stream As New MemoryStream()
        Dim totallicenseFile As String = Server.MapPath("bin\Aspose.Total.lic")
        Dim license1 As New Aspose.BarCode.License()
        license1.SetLicense(totallicenseFile)
        Dim bbuilder As New BarCodeBuilder()
        If BarCodeType = "P" Then
            bbuilder.SymbologyType = Aspose.BarCode.Symbology.Pdf417
        Else
            bbuilder.SymbologyType = Aspose.BarCode.Symbology.Code128
        End If
        Dim strBarValue As String
        strBarValue = "ACS" & Client_Id & "+" & Session.Item("TaskSelBaseID") & "+" & "13" & "+" & DocumentID & "+" & DocumentDescriptionUpdated
        bbuilder.CodeText = strBarValue
        Dim caption As New Caption(strBarValue)
        caption.Font = New System.Drawing.Font("Arial", 16, System.Drawing.FontStyle.Bold)
        caption.TextAlign = System.Drawing.StringAlignment.Center
        bbuilder.CaptionAbove = caption
        bbuilder.AutoSize = True
        bbuilder.CodeLocation = CodeLocation.None
                 
        bbuilder.Margins.Top = 0.0F
        bbuilder.Margins.Bottom = 0.0F
        bbuilder.Margins.Left = 0.0F
        bbuilder.Margins.Right = 0.0F

        'bbuilder.Rotate(Aspose.BarCode.RotationDirection.Clockwise, RotationAngle.OneHundredEightyDegree)
        'bbuilder.RotationAngleF() = 0
        bbuilder.xDimension = 0.5F
        bbuilder.yDimension = 4.0F
        bbuilder.AspectRatio = 1.5F
        Dim bmp As System.Drawing.Bitmap = bbuilder.GetOnlyBarCodeImage()
       
        Dim tt As System.Drawing.Bitmap = bbuilder.GetCustomSizeBarCodeImage(New System.Drawing.Size(bmp.Width * 5, bmp.Height * 5), False)

        bbuilder.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)



        Dim license As New Aspose.Pdf.License()
        license.SetLicense(Server.MapPath("bin/Asposet.Total.lic"))
        Dim pdfDocument As New Aspose.Pdf.Document(DocumentFullPathWithName)



        'set coordinates
        Dim lowerLeftX As Integer = 0
        Dim lowerLeftY As Integer = 0
        Dim upperRightX As Integer = 0
        Dim upperRightY As Integer = 0
        GetPdfImageLocationValue(ddlBCPosition.SelectedValue, lowerLeftX, lowerLeftY, upperRightX, upperRightY)

     

        For icount As Integer = 0 To PDFPageCount
            If lst.Contains(icount) Then


                'get the page where image needs to be added
                Dim page As Page = pdfDocument.Pages(icount)
                page.Resources.Images.Add(stream)

                'using GSave operator: this operator saves current graphics state
                page.Contents.Add(New [Operator].GSave())

                'create Rectangle and Matrix objects
                Dim rectangle As New Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY)
                Dim matrix As New Aspose.Pdf.DOM.Matrix(New Double() {rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY})

                'using ConcatenateMatrix (concatenate matrix) operator: defines how image must be placed
                page.Contents.Add(New [Operator].ConcatenateMatrix(matrix))
                Dim ximage As XImage = page.Resources.Images(page.Resources.Images.Count)

                'using Do operator: this operator draws image
                page.Contents.Add(New [Operator].Do(ximage.Name))

                'using GRestore operator: this operator restores graphics state
                page.Contents.Add(New [Operator].GRestore())

            End If
        Next

        oBuckVbNet = New Buckvbnet()
        oBuckVbNet.AssignStrConnection()
        Dim myArray As Array
        Dim newVal As String

        oBuckVbNet.SelectCmd("Select iss3_doc_number_seq.nextval from dual", "ISS3_MEMDOC")
        myArray = Me.oBuckVbNet.GetDbArray()

        If myArray.Length > 0 Then
            newVal = Convert.ToString(myArray(0, 0))
            'save updated document
            Dim NewDocumetName As String = newVal & "_" & DocumentName.Split(".")(0).ToString() & "_BC" & ".pdf"
            pdfDocument.Save(DocumentPath & "" & NewDocumetName)

            
        End If
    End Sub


Private Sub GetPdfImageLocationValue(ByVal location As String, ByRef lowerLeftX As Integer, ByRef lowerLeftY As Integer, ByRef upperRightX As Integer, ByRef upperRightY As Integer)
        Select Case location
            Case "1"
                ' Bottom Middle
                lowerLeftX = 400
                lowerLeftY = 50
                upperRightX = 210
                upperRightY = 10
                Exit Select
            Case "2"
                'Bottom Left
                lowerLeftX = 300
                lowerLeftY = 70
                upperRightX = 10
                upperRightY = 10
                Exit Select
            Case "3"
                'Bottom Right
                lowerLeftX = 600
                lowerLeftY = 50
                upperRightX = 410
                upperRightY = 10
                Exit Select
            Case "4"
                'Top Middle
                lowerLeftX = 400
                lowerLeftY = 800
                upperRightX = 210
                upperRightY = 760
                Exit Select
            Case "5"
                'Top Left
                lowerLeftX = 200
                lowerLeftY = 800
                upperRightX = 10
                upperRightY = 760
                Exit Select
            Case "6"
                'Top Right
                lowerLeftX = 600
                lowerLeftY = 800
                upperRightX = 410
                upperRightY = 760
                Exit Select
        End Select
    End Sub

Problem reading Code-128 barcodes created using Aspose.Barcode

Hello,

I am attempting to create a series of various sized code-128 bar codes using Aspose.Barcode, then read those various sized bar codes using Aspose.Barcode.  Unfortunately, I am having little success.

The various sized, programmatically generated bar codes are printed out, then scanned via a Xerox WorkCenter 5945 (400DPI) to a network folder.  Once scanned, a software application utilizing Aspose.Barcode attempts to read the various bar codes and record the data contained within the bar codes.  As stated, I am having very little success getting a read of high enough quality to be useful.  I have attached a PDF that contains all of the code-128 bar codes, of which only the second one could be read to any level of success.

The code used to create the bar codes and read the bar codes was taken directly from your documentation, but I will provide it to you anyway:

Creation:

BarCodeBuilder bb = new BarCodeBuilder();
Aspose.BarCode.License bcLicense = new Aspose.BarCode.License();
System.IO.Stream bcstream = System.IO.File.OpenRead(Server.MapPath("~") + @"\bin\Aspose.BarCode.lic");
bcLicense.SetLicense(bcstream);
bcstream.Close();

bb.CodeText = "some test value";
bb.CodeLocation = CodeLocation.None;
bb.SymbologyType = Symbology.Code128;
bb.BackColor = System.Drawing.Color.White;
bb.ImageQuality = ImageQualityMode.Default;
bb.AutoSize = false;
bb.ImageHeight = 8.75f;
bb.ImageWidth = 86.25f;
bb.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;
bb.Save("test.png", System.Drawing.Imaging.ImageFormat.Png);


Obviously the ImageHeight and ImageWidth differ throughout the provided PDF.  8.75f and 86.25f are what generated the first bar code on the attached document.

Reading:

Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();
pdfExtractor.BindPdf("path to document");

Document pdfDocument = new Document(document.FullName);

pdfExtractor.StartPage = 1;
pdfExtractor.EndPage = 1;
 pdfExtractor.ExtractImageMode = ExtractImageMode.ActuallyUsed;
pdfExtractor.ExtractImage();

 while (pdfExtractor.HasNextImage())
{
MemoryStream imageStream = new MemoryStream();
pdfExtractor.GetNextImage(imageStream);
imageStream.Position = 0;

using (Aspose.BarCodeRecognition.BarCodeReader barcodeReader = new Aspose.BarCodeRecognition.BarCodeReader(imageStream, BarCodeReadType.Code128))
{
barcodeReader.ImageBinarizationHints RecognitionHints.ImageBinarization.Grayscale;
barcodeReader.ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing;
barcodeReader.ImageBinarizationHints = RecognitionHints.ImageBinarization.ComplexBackground;

string barcodeCodeText = barcodeReader.GetCodeText();
string barcodeReadType = barcodeReader.GetReadType().ToString();
float barcodeQuality = barcodeReader.GetRecognitionQuality();

System.Console.WriteLine("Codetext found: " + barcodeCodeText + ", Symbology: " + barcodeReadType + ", Quality: " + barcodeQuality.ToString());

barcodeReader.Close();
}
}


Thank you for your help.  

Barcode Recognition and Reliability Issues for v6.8.0.0

Hello,

We've been experiencing issues with Aspose Barcode for .NET with regards to reliability and accuracy. Issues are detailed below:

1. Barcode Region Points Indexing
  • Index for Bottom Left and Top Right seem to be interchanged
  • According to this: http://www.aspose.com/docs/display/barcodenet/Getting+BarCode+Region+Information+from+the+Image, Points[1] correspond to Bottom Left, while Points[3] correspond to Top Right
  • Based from actual results, Points[1] correspond to Top Right, while Points[3] correspond to Bottom Left
  • See code implementation for ValidateRegionPointsOrder() method in the sample project
  • Screenshot: issue-1.png

2. Barcode Region Points Accuracy
  • In the sample project, four barcodes are printed in a 794 x 1123 image:
    • A16-4: no rotation and located at (25,5)
    • B16-4: 270 degree rotation and located at (5,1097)
    • C16-4: 180 degree rotation and located at (768,1117)
    • D16-4: 90 degree rotation and located at (788, 25)
  • Barcode region points are significantly off from expected values
  • See code implementation for ValidateBarcodeCornerCoordinates() method in the sample project
  • Screenshot: issue-2.png

3. Barcode detection failure with Orientation Hint involved
  • For NoRotate:
    • Barcode B16-4 is detected twice
  • For Rotate90:
    • Only barcodes C16-4 and B16-4 are detected
    • Barcode that doesn't exist in the sample image is detected (0697247)
  • For Rotate180:
    • All four barcodes are detected
  • For Rotate270:
    • Only barcodes D16-4, B16-4 and C16-4 are detected
  • Results worsen if ImageBinarizationHint of InvertImage is removed
  • See code implementation for ValidateRecognitionWithOrientation() method in the sample project
  • Screenshot: issue-3.png

4. Barcode detection failure worsens with images generated using Aspose Barcode for .NET 6.8.0.0 DLL
  • Sample image generated using new DLL is named "sample_new.jpg"
  • Sample image generated using old DLL (5.7.0.0) is named "sample.jpg"
  • Try to use "sample_new.jpg" to see how the recognition worsens for Issues 2 and 3

NOTES:
  • Related issue for Issue 3 is already logged here: http://www.aspose.com/community/forums/thread/615598/barcode-recognition-efficiency-from-5.7.0.0-to-6.8.0.0.aspx
  • License file was removed from the sample project for security purposes
     

Can't extract barcode value from these jpgs

Hi,

We make an intensive use of the Aspose barcode reader, we use it to read barcodes from like 3000 document/day.

The library fails to read barcodes ( or gives wrong value ) in some cases, where the codebare is clear and other libraries ( http://demo.leadtools.com/OnlineRecognitionDemo/default.aspx ) give the expected value very fast ( 22ms, but this is more due to the native code speed ).

Please find attached 34 samples of those documents :

Guid.jpeg => Aspose BarCode couldn't extract the barcode
Guid   #barcode => it did but the barcode value is wrong

The barcode is a 128Code and should be something like : "00100  PER000184412050614003897971". They all must start with "00100  ".



Here is our code :
        public static IEnumerable<BarCode> ReadBarCodesFromPdf(string filePath, int barcodePerPage = 1, float relativeX = 0, float relativeY = 0, float relativeWidth = 1, float relativeHeight = 1, BarCodeReadType codeType = BarCodeReadType.AllSupportedTypes)
        {
            if (System.IO.Path.GetExtension(filePath).ToLower() != ".pdf")
                yield break;

            using (var pdf = new Aspose.Pdf.Document(filePath))
                for (int i = 0; i < pdf.Pages.Count; ++i)
                {
                    var abs = new ImagePlacementAbsorber();
                    pdf.Pages[i + 1].Accept(abs);
                    foreach( ImagePlacement imagePlacement in abs.ImagePlacements)
                    {
                        var xImage = imagePlacement.Image;
                        using (var memStream = new MemoryStream())
                        {
                            var barCode = default(string);
                            var barCodeRegion = default(BarCodeRegion);
                            xImage.Save(memStream);

                            var strbuilder = new StringBuilder();
                            using (var bitmap = new Bitmap(memStream))
                            {
                                var imguid = Guid.NewGuid();
                                bitmap.Save(string.Format("e:\\{0}.jpeg", imguid));
                                
                                using (var barcodeReader = new BarCodeReader(bitmap, new System.Drawing.Rectangle((int)(bitmap.Width * relativeX), (int)(bitmap.Height * relativeY), (int)(bitmap.Width * relativeWidth), (int)(bitmap.Height * relativeHeight)), codeType))
                                {
                                    barcodeReader.ExpectedBarCodeCount = barcodePerPage;
                                    barcodeReader.Timeout = 30000;
                                    var nb = barcodePerPage;
                                    while (nb-- > 0)
                                    {
                                        try
                                        {

                                            var readValue = false;
                                            Thread taskThread = null;
                                            var task = Task.Factory.StartNew(() => {taskThread = Thread.CurrentThread; readValue = barcodeReader.Read(); }, TaskCreationOptions.LongRunning);
                                            Task.WaitAll(new Task[] { task }, 35000);                                            
                                            //try
                                            //{
                                            //    if (!task.IsCompleted &&  taskThread != null) 
                                            //        taskThread.Abort();
                                                
                                            //}
                                            //catch(NullReferenceException ex) // il peut devenir null entre temps
                                            //{ }
                                            //GC.Collect();
                                            if (!readValue)
                                                break;
                                        }
                                        catch (Exception ex)
                                        {
                                            _log.Error(string.Format("Error when trying to extract from file {0} | page : {1}", filePath, i), ex);
                                            break;
                                        }
                                        var region = barcodeReader.GetRegion();
                                        if (region != null)
                                        {
                                            barCode = barcodeReader.GetCodeText();

                                            bitmap.Save(string.Format("e:\\{0}    #{1}.jpeg", imguid, barCode));
                                            barCodeRegion = region;
                                                yield return new BarCode(i + 1, barCodeRegion, barCode);
                                                _log.InfoFormat("BarCode : {0}", barCode);
                                                break;
                                            }
                                        }
                                }
                            }
                        }
                    }
                }
        }


We use the version 6.0.0, we haven't seen a resolved ticket in the new versions that could solve this.


Thanks in advance,

Very Small Barcodes to generate

Hi,

I have a requirement to generate very small barcodes could be placed on chemical vials. Barcode(Code128) maximum size would be 1/2" inch. Could you please let me know whether we can generate the barcodes as expected.

 I would like to generate the barcode for "123456-AB" and the barcode size should be half inch (1/2"), Zebra software is able to generate the barcode as half inch. It would be great to send some sample barcodes images that are below or around half inch for text "123456-AB" and could able to scan the images.

 We are ready to purchase the software if we could be to generate the barcodes as expected.

I have written sample program to generate Code128.

BarCodeBuilder builder = new BarCodeBuilder(getBarcodeText(), Symbology.Code128);

BufferedImage bi = builder.getCustomSizeBarCodeImage(new Dimension(40,20), true);

above code thrown exception  : com.aspose.barcode.BarCodeException: GetCustomSizeBarCodeImage - required size is too small to fit the image

Could you please suggest/guide me to accomplish barcode generation.

Thanks

Dhorrairaajj



DataMatrix BarCode Readable by 3.6.1.0 is not readable by 6.8

Hello Support, I'm struggling to get the correct settings in BarCodeReader so it will recognize the datamatrix barcode in the attached file.  With the 3.6.1.0 dll of Aspose.BarCodeRecognition all I had to do was new BarCodeReader(stream, BarCodeReadType.DataMatrix) and it just worked.

That doesn't work with 6.8 (and 6.6) so I'm guessing there are some new options I have to set. I have tried all of these.  

// need to add these guys because the current version of Aspose is
// having problems with DataMatrix reads
var reader1 = new BarCodeReader(stream, BarCodeReadType.DataMatrix)
{
ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing,
OrientationHints = RecognitionHints.Orientation.NoRotate
};

var reader2 = new BarCodeReader(stream, BarCodeReadType.DataMatrix)
{
ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing,
OrientationHints = RecognitionHints.Orientation.Rotate90
};

var reader3 = new BarCodeReader(stream, BarCodeReadType.DataMatrix)
{
ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing,
OrientationHints = RecognitionHints.Orientation.Rotate180
};

var reader4 = new BarCodeReader(stream, BarCodeReadType.DataMatrix)
{
ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing,
OrientationHints = RecognitionHints.Orientation.Rotate270
};

Can you help let me know what I am missing

QR code generation

Hi,

I'm struggling to understand the rather messy BarCodeBuilder class.
The javadoc for method setGraphicsUnit() vaguely refers to some System.Drawing.GraphicsUnit for which I cannot find any information.
Please direct me to the relevant documentation.

Thanks
Mario

Arial font size 10 and 12 not displaying text correctly

I am having a strange issue with Arial font when the size is set to 10 or 12.
If the code text is more than 9 characters the last character does not show in the displayed text.
So the value 12312312345 will display 1231231234 but the bar code is encoded with the full text.
If I set the font size to any other value it displays correctly.
I am applying the license we purchased so it is not an evaluation issue.
Here is my code:

Font font = new Font("Arial", Font.PLAIN, 12);
BarCodeBuilder builder = new BarCodeBuilder();
builder.setSymbologyType(Symbology.Code128);
builder.setCodeText("12312312345");
builder.setCodeLocation(CodeLocation.Below);
builder.getCaptionAbove().setTextAlign(StringAlignment.Center);
builder.setCodeTextFont(font);
builder.getCaptionBelow().setVisible(true);

FileOutputStream fos = new FileOutputStream(new File("c:/testCodes//testDisplay.png"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
builder.save(baos, BarCodeImageFormat.Png);
baos.writeTo(fos);

I also tried setting the font by using builder.getCaptionBelow().setFont(font) but that ignores the font all together.
This is a common font setting that will be used in our application so this issue will need to be resolved. 
We are using the Java Bar code library.

Thank you
Fred


Cannot read Barcode from PDF

I am not able to read the barcode (Code39Standard) in the attached PDF.  We have no control over the PDFs we receive or the barcodes included.

Using other products I am able to read the barcode.  Using the PdfExtractor code that I have seen in a few other posts to this forum.

Code128 GetCodeText error?

Hi,

   Please see attach in detail.

   Attach tiff image(1 page) has no barcode(code128) inside.

   But, can get the code text "00" from it, why?

  Could you help to solve the problem? thanks!

Regards,
Gary 

Are appid and sid visible in barcode URL?

I am in the process of selecting an SaaS barcode generator solution and am consider Aspose.Barcode for Cloud. If I have an image tag in an HTML document with an Aspose.Barcode for Cloud URL as its source, do I include my appid and sid in that URL and doesn't that make it easy for anyone to use my appid and sid and generate barcodes that get charged against my account? 

Transparent Background Problem

Hi,

I was working with aspose.barcode and i found a bug-or i made mistake with parameters. When you try to make barcode with transparent background, barcode dont give correct result.

Here is my code
BarCodeBuilder builder = new BarCodeBuilder();
builder.GraphicsUnit = GraphicsUnit.Pixel;
builder.SymbologyType = Symbology.QR;
builder.CodeText = "1"; builder.CodeLocation = CodeLocation.None; builder.AutoSize = false; builder.BarHeight = 250; builder.ImageQuality = ImageQualityMode.Default; builder.CaptionAbove.Visible = false; builder.CaptionBelow.Visible = false; builder.BackColor = Color.Transparent; builder.QRErrorLevel = eBABarcodeGenerator.QRErrorLevel.LevelH; builder.QREncodeMode = eBABarcodeGenerator.QREncodeMode.Auto;Bitmap code = builder.GetCustomSizeBarCodeImage(new Size(250, 250), false); code.Save(@"c:\e39.png", System.Drawing.Imaging.ImageFormat.Png);return code;
If I use like this result is like 1.png. 
If I change the BackgroundColor = Color.FromArgb(254, Color.White) result is like 2.png
If I change the BacgroundColor = Color.White-Or Color.FromArgb(255, anyColor)- result is like 3.png
But I want to create a barcode like 3.png but transparent. What can i do?

PDF417 not recognised (version 6.8.0.0)

hi,
We have PDF417 barcode with special encoded string in some documents, and this barcode doesn't recognised by Aspose.BarCode.Toolkit.exe. see example in attachment.

Some applications can read this image on my android phone, so this barcode is valid.

We want to decode some paper docs in our applications and looking for working SDK now.

Issues with OneCode always giving us the same barcode

We did three separate examples and Code39 gave us three different, unique barcodes (as we expected).  

However, when we did it for OneCode, it gave us 3 of the same barcode.  Are we doing something wrong or is there an issue with OneCode?

Examples are attached - Code39 is on top in all 3 examples and OneCode is on the bottom.

Barcode XDimension

Hi,

I'ved tried the following code sample to create barcodes with different XDimension setting:

//Instantiate barcode objectBarCodeBuilder bb = new BarCodeBuilder();//Set the Code text for the barcodebb.CodeText = "1234567";//Set the symbology type to Code128bb.SymbologyType = Symbology.Code128;//Set the X-Dimension for the bars of the barcodebb.xDimension = 0.5f;//Set the measuring unit of barcode to millimeterbb.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;//Save the image to your system//and set its image format to Jpegbb.Save("barcode5.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);



I used xDimension 0.3f (barcode3.jpg), 0.5f (barcode5.jpg) and 0.7f (barcode7.jpg).
The resulting images for 0.3 and 0.5 are identical, and also 0.7 doesn't match with the illustration here: http://www.aspose.com/docs/display/barcodenet/Manage+X+Dimension+and+Y+Dimension


I've used the latest version.


Not reading all Code128 Barcodes

In the attached document we are not reading all barcodes.  What we are reading is:

Barcode found: BA0693955^ILDSR   ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 1
Barcode found: BA0693955^CADEC   ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 2
Barcode found: BA0693955^BA4BATCH^RB^12-13^ - on page 5
Barcode found: BA0693955^BA1322  ^RB^12-13^ - on page 8
Barcode found: BA0693955^CMDS02  ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 10
Barcode found: BA0693955^IMSCH   ^RB^12-13^ - on page 11
Barcode found: BA0693955^NBABATCH^RB^12-13^ - on page 12
Barcode found: '? - on page 13
Barcode found: '? - on page 20
Barcode found: BA0693955^MCS90   ^RB^12-13^ - on page 24

The barcodes that should have been read are:

Barcode found: BA0693955^ILDSR   ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 1
Barcode found: BA0693955^CADEC   ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 2
Barcode found: BA0693955^BA4BATCH^RB^12-13^ - on page 5
Barcode found: BA0693955^BA1322  ^RB^12-13^ - on page 8
Barcode found: BA0693955^CMDS02  ^RB^04/09/12 MILLER DISTRIBUTING LLC  ^ - on page 10
Barcode found: BA0693955^IMSCH   ^RB^12-13^ - on page 11
Barcode found: BA0693955^NBABATCH^RB^12-13^ - on page 12
Barcode found: BA0693955^NBCBATCH^RB^12-13^ - on page 22
Barcode found: BA0693955^MCS90   ^RB^12-13^ - on page 24

The barcode on page 22 is not being read.

 

The following is the code that I am using

Document pdfDocument = new Document(filename);
int pageCount = pdfDocument.Pages.Count;

for (var page = 1; page <= pageCount; page++)
{
    Aspose.Pdf.Facades.PdfConverter converter = new Aspose.Pdf.Facades.PdfConverter();
    converter.BindPdf(filename);
    converter.RenderingOptions.BarcodeOptimization = true;
    converter.StartPage = page;
    converter.EndPage = page;
    converter.Resolution = new Aspose.Pdf.Devices.Resolution(300);
    converter.DoConvert();

    MemoryStream stream = new MemoryStream();
    converter.GetNextImage(stream, ImageFormat.Png);
    using (BarCodeReader barcodeReader = new BarCodeReader(stream, BarcodeData.BarcodeSymbology))
    {
        if (BarcodeData.VerifyChecksum)
            barcodeReader.ChecksumValidation = BarcodeData.ChecksumValidate;

        while (barcodeReader.Read())
        {
            barcodesByPage = new AsposeBarcodesByPage();
            barcodesByPage.Barcode = barcodeReader.GetCodeText();
            barcodesByPage.Page = page;
            barcodesColl.Add(barcodesByPage);
        }
    }
    converter.Close();
    converter.Dispose();
}

 

 

error when RecognizeBarCodeFromMultipageTiff using vs2012 C#

Hi,

      When I try to Recognize BarCode From Multi-page Tiff using VS2012 C#.

       It caused a error exception(out of memory). 

       But it run correctly at VS2005, Why?

       Attachment is the VS2012 C# code and testing sample.

       Please help to solve this problem. thanks!

Regards,
Gary Lee
chunhsiung.lee@twn.fujixerox.com

Bar Code random numbers

Hello, We are using your bar code product Lic ver 3.0, the issue we are having when it reads bar code we see random numbers, also some of the tif file does not read. In the screen shot second part is bar code stating with 99 but first part (3141764) we are not sure where that came from. Sometimes it gives some random number our bar code starts with 99, Attach 2 screen shots examples. Here is the code we need your help. 

thanks
Solomon 
 

namespace BarcodeTester
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var x = this.openFileDialog1.ShowDialog();
            if (x == System.Windows.Forms.DialogResult.OK)
            {
                this.textBox1.Text = this.openFileDialog1.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.dataGridView1.DataSource = GetDataTable();
            this.dataGridView1.Refresh();

            if (string.IsNullOrWhiteSpace(this.textBox1.Text))
            {
                MessageBox.Show("Enter File");
                this.textBox1.Focus();
                return;
            }

            if (!(File.Exists(this.textBox1.Text.Trim())))
            {
                MessageBox.Show("File not found");
                this.textBox1.Focus();
                return;
            }

            this.dataGridView1.DataSource = this.Process(this.textBox1.Text.Trim());
        }

        private static DataTable GetDataTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Document #", typeof(int));
            dt.Columns.Add("BarCode");
            return dt;
        }

        public DataTable Process(string FilePath)
        {
            DataTable dt = GetDataTable();

            if (File.Exists(FilePath))
            {
                using (Image img = GetImage(FilePath))
                {
                    int totalFrame = img.GetFrameCount(FrameDimension.Page);

                    if (totalFrame > 0)
                    {
                        Aspose.BarCode.License license = new Aspose.BarCode.License();
                        license.SetLicense("Aspose.BarCode.lic");

                        string BarCodeReadType = ConfigurationManager.AppSettings["BarCodeReadType"];
                        string BarCodePrefix = ConfigurationManager.AppSettings["BarCodePrefix"];

                       // IEnumerable<RecognitionHints.Orientation> directions = Enum.GetValues(typeof(RecognitionHints.Orientation)).Cast<RecognitionHints.Orientation>();

                        int i = 0;
                        while (i < totalFrame)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = i + 1;

                            // Set the active page and feed it to the BarCodeReader
                            img.SelectActiveFrame(FrameDimension.Page, i);

                            using (Bitmap page = new Bitmap(img))
                            {
                                List<string> bam = new List<string>();
                              //  int j = 0;
                             //   while ((j < directions.Count()))
                             //   {

                              
                                using (BarCodeReader reader = new BarCodeReader(page, (BarCodeReadType) Enum.Parse(typeof(BarCodeReadType), BarCodeReadType)))
                                {
                                   
                            
                                    reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing;
                                  //  reader.OrientationHints = directions.ElementAt(j);
                                    

                                    while (reader.Read()) // && dr.IsNull("BarCode"))
                                    {
                                        bam.Add(reader.GetCodeText());
                                    }

                                    reader.Close();
                                }

                                //    j++;
                                //}

                                string s = null;
                                foreach (string s2 in bam)
                                {
                                    if (s != null)
                                        s += ',';
                                    s += s2;
                                }

                                dr["BarCode"] = s;
                            }

                            dt.Rows.Add(dr);
                            i++;
                        }
                    }
                }
            }

            return dt;
        }

        public Image GetImage(string filePath)
        {
            Image img = null;

            bool wait = false;
            while (img == null)
            {
                if (wait)
                    System.Threading.Thread.Sleep(1000);
                else
                    wait = true;

                try
                {
                    img = Image.FromFile(filePath);
                }
                catch { };
            }

            return img;
        }
    }
}

Incorrect GIF produced by Aspose BarCode

Hi,

the attached QR code in GIF format has been produced by Aspose BarCode.

The byte at position 0xB is the background color index. Since the byte at position 0xA indicates the presence of a global color table, the background color index must be valid. However, the global color table only has 2 entries (6 bytes) while the background color index is 0xFF, which is plainly out of range.

Please either eliminate the global color table altogether or ensure that the background color index is correct.

Regards
Mario

Unable to read multiple DATAMATRIX images from tiff file

Hi, I am using aspose-barcode-6.8.0.jar to read multiple barcode from tiff file which has 9 barcode in one page, barcode type is DATAMATRIX and dpi is 200x200. We cannot change the dpi settings. 
But I am able to read only 5 barcodes out of 9. Please help me to resolve it...

Code which i am using is given below.
String fileName = "test.tif";
Iterator readers = javax.imageio.ImageIO.getImageReadersBySuffix("tiff");
if (readers.hasNext()) {
File fi = new File(fileName);
ImageInputStream iis = javax.imageio.ImageIO.createImageInputStream(fi);
 
TIFFDecodeParam param = null;
ImageDecoder dec = ImageCodec.createImageDecoder("tiff", fi, param);
//Get the page count of the tiff image
int pageCount = dec.getNumPages();
ImageReader _imageReader = (ImageReader) (readers.next());
if (_imageReader != null) {
_imageReader.setInput(iis, true);
 
for (int i = 0; i < pageCount; i++) {
BufferedImage _bufferedImage = _imageReader.read(i);
BarCodeReader reader = new BarCodeReader(_bufferedImage, BarCodeReadType.DataMatrix);
while (reader.read()) {
System.out.println(reader.getCodeText());
}
}
 
}
}

Best Regards,
Palanivelu R
Viewing all 333 articles
Browse latest View live