Read barcode from PDF file

Is there any Java API that can find the barcode inside an open file (scanned PDF) and then extract the data from the barcode? Or how to solve this problem?

+4
source share
1 answer

If you are running Windows, the ClearImage Barcode SDK has a Java API. It can read and decode barcodes from PDF files or images and provide you with decoded data.

Code example:

public static void testDataMatrix () {
  try { 
       String filename  = "1.png ";
       CiServer objCi = new CiServer();
       Ci = objCi.getICiServer();

       ICiDataMatrix reader = Ci.CreateDataMatrix(); // read DataMatrix Barcode
       reader.getImage().Open(filename, 1);
       int n = reader.Find(0); // find all the barcodes in the doc
       for (i = 1; i <= n; i++) {
          ICiBarcode Bc = reader.getBarcodes().getItem(i); // getItem is 1-based
          System.out.println("Barcode " + i + " has Text: " + Bc.getText());
       }
   } catch (Exception ex) {System.out.println(ex.getMessage());}
 }

Another question is Accusoft Barcode Xpress , which also has a Java API.

Disclaimer: In the past, I worked on Inlite.

+1
source

Source: https://habr.com/ru/post/1545347/


All Articles