Image file does not have text values

I tries your demo program to see the text values.
There is no output.
If it works, how do I convert to pdf file?

Thanks
Chang Shin

String imagePath = “/AATest/Email/Test/screenshot.bmp”;
String xmlEtalonFileName = “englishStandarts”;
String fontCollectionFileName = “arialAndTimesAndCourierRegular.xml.bin”;
String resourcesFilePath = “/AATest/Email/Test/resources.zip”;

try
{
    // Create an instance of OcrEngine class but providing required
    // parameters
    OcrEngine ocr = new OcrEngine(ResourcesSource.BINARY_ZIP_FILE,
    resourcesFilePath, xmlEtalonFileName, fontCollectionFileName);
    ocr.getConfig().setNeedRotationCorrection(false);

    // Set image file
    File image = new File(imagePath);
    ocr.setImage(image);

    // Add language
    ILanguage language = Language.load(“english”);
    ocr.getLanguages().addLanguage(language);

    // Create a new file to write output
    Writer output = null;
    File file = new File("/AATest/Email/Test/Output.txt");
    output = new java.io.BufferedWriter(new java.io.FileWriter(file));

    // Perform OCR and get extracted text
    if (ocr.process())
    {
        output.write("\ranswer -> " + ocr.getText());
        // Get info about each part of the recognized text
        IRecognizedText recognizedText = ocr.getText();
        IRecognizedTextPartInfo[] parts = recognizedText.getPartsInfo();
        System.out.println(“parts.size() =”+parts.length);
        for (IRecognizedTextPartInfo part : parts)
        {
            output.write("\r\n\r\npart.getText() => " + part.getText());
        }
        output.close();
        System.out.println(“Done”);
    }

}
catch (Exception ex)
{
    ex.printStackTrace();
}

Hi Chang,

Thanks for your inquiry. Currently Aspose.OCR supports Arial, Times New Roman and Tohama
fonts. Recognition accuracy of big font sizes i.e. 32pts and above is 90% and
smaller font sizes have less accuracy.

Moreover, regarding generation of Pdf document from recognized characters requirements, I’ve logged an investigation task as OCR-33292 in our issue tacking system. We will keep you updated regarding issue status via this forum thread.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.