Java OCR and Barcode Recognition

High performance, royalty-free Java OCR and barcode recognition on Windows, Linux, Mac OS and Unix

Resources and FAQ's for Asprise OCR for Java

    Recognizes text only or barcode only

    To recognize text only:

    String s = ocr.recognize(new File[] {new File("test.png")},
      Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);

    To recognize barcode only:

    String s = ocr.recognize(new File[] {new File("test.png")},
      Ocr.RECOGNIZE_TYPE_BARCODE, Ocr.OUTPUT_FORMAT_PLAINTEXT);

    Perform OCR on part of the image

    In some cases, you might not want to OCR the whole image. In that case, you can OCR on part of the image to save time:

    String s = ocr.recognize("C:/test.png", -1, 0, 0, 400, 200,
      Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);

    The above code OCR the top left part of the image with width 400 pixels and height 200 pixels.

    Perform OCR on multiple input files in one shot

    String s = ocr.recognize("C:/test.png;C:/test2.jpg", -1, 0, 0, 400, 200,
      Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);

    Perform OCR on a certain page from the specified TIFF file

    A TIFF file may contain multiple pages. If you need to recognize only a certain page, you can specify the page number as following:

    String s = ocr.recognize("C:/test.png", 2, -1, -1, -1, -1,
      Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);

    Note 2 means the second page (the page number of the first page is 1).

    Perform OCR on a PDF input file

    You use the following method to perform OCR on a PDF input file:

    String s = ocr.recognize("C:/test.pdf", -1, 100, 100, 400, 200,
      Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);