I've managed to import the library but now, i've copied the hello.java and sampleconfig.java file into eclipse, I get no syntax errors but when i compile and run the program i get an "Unspecified Error" printed to the console. The only reason that I can think of is that I am on a Developer Trial and that Licenses number is not allowed to use the API.

Hello.java:

import com.abbyy.ReceiptCapture.*;
public class Hello {     
    public static void main( String[] args ) {  
        try {
            Hello application = new Hello();
            application.Run();
        } catch( Exception ex ) {
            displayMessage( ex.getMessage() );

        }
    }
    public void Run() throws Exception {
        // Load ABBYY Receipt Capture Engine
        loadEngine();
        try{
            // Process with ABBYY Receipt Capture Engine
            processWithEngine();
        } finally {
            // Unload ABBYY Receipt Capture Engine
            unloadEngine();
        }
    }
    private void loadEngine() throws Exception {
        displayMessage( "Initializing Engine..." );
        try{
        engine = Engine.GetEngineObject(SampleConfig.GetDllFolder(),SampleConfig.GetDeveloperSN());
        }
        catch( Exception ex ) {
            displayMessage( "Message = " + ex.getMessage() );
            if( ex instanceof EngineException ) {
            displayMessage( "HResult = " + Integer.toString( ( ( EngineException )ex ).getHResult() ) );
            }
            }
    }
    private void processWithEngine() {
        try {
            // Process sample image
            processImage();
        } catch( Exception ex ) {
            displayMessage( ex.getMessage() );
        }
    }

    private void processImage() {
        String imagePath = SampleConfig.GetSamplesFolder() + "/tester.jpg"; //sets the path to image 
        try {
            // Create recognizer
            IReceiptRecognizer recognizer = engine.CreateReceiptRecognizer();

            try {
                // Add image file to recognizer
                displayMessage( "Loading image..." );
                recognizer.AddImageFile( imagePath, null );

                // Process images in the recognizer
                displayMessage( "Process..." );
                recognizer.Process( null );

                // Save results to XML
                displayMessage( "Saving results..." );

                if (recognizer.getReceipts().getCount() > 0) {
                    IReceipt receipt = recognizer.getReceipts().Item(0);

                    String xmlExportPath = SampleConfig.GetSamplesFolder() + "\\SampleImages\\Receipt_01.xml";
                    receipt.ExportToXml( xmlExportPath, null );
                }
            } finally {
                // Close recognizer
                recognizer.Close();
            }
        } catch( Exception ex ) {
            displayMessage( ex.getMessage() );
        }
    }

    private void unloadEngine() throws Exception {
        displayMessage( "Deinitializing Engine..." );
        engine = null;
        Engine.DeinitializeEngine();
    }

    private static void displayMessage( String message ) {
        System.out.println( message );
    }

    private IEngine engine = null;
}

SampleConfig.java:

public class SampleConfig {
    public static String GetDllFolder() {
        if( is64BitJVMArchitecture() ) {
            return "C:/Users/Jonathan Persaud/Desktop/RcSdk1Beta3/ABBYY SDK/11/ReceiptCapture/Bin64/ReceiptCapture.dll";
        } else {
            return "C:/Users/Jonathan Persaud/Desktop/RcSdk1Beta3/ABBYY SDK/11/ReceiptCapture/Bin64/ReceiptCapture.dll";
        }
    }
    // Return developer serial number for Receipt Capture SDK
    public static String GetDeveloperSN() {
       return "I wont post my license but in my actual code my license is in the quotation";
    }
    // Return full path to Samples directory
    public static String GetSamplesFolder() {
        return "C:/Users/Jonathan Persaud/Desktop/sample";
    }
    // Determines whether the JVM architecture is a 64-bit architecture
    private static boolean is64BitJVMArchitecture()
    {
        String jvmKeys [] = {
            "sun.arch.data.model", 
            "com.ibm.vm.bitmode", 
            "os.arch"
        };
        for( String key : jvmKeys ) {
            String property = System.getProperty( key );
            if( property != null ) {
                if( property.indexOf( "64" ) >= 0 ) {
                    return true;
                } else if( property.indexOf( "32" ) >= 0 ) {
                    return false;
                } else if( property.indexOf( "86" ) >= 0 ) {
                    return false;
                }
            }
        }
        return false;
    }
}

Error:

Initializing Engine... Message = Unspecified error

HResult = -2147467259 null Deinitializing Engine...

asked 13 Jun '16, 23:29

persaudJon's gravatar image

persaudJon
217

edited 10 Mar, 15:10

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦
1.5k16


Hi,

Please accept my apologies for lond silence.

The “Unspecified error” may occur if you try to use ReceiptCapture as a 64bit library, but you compile your application with 32bit JDK, or in reverse when you've installed ReceiptCapture as a 32bit library, but you compile the application with 64bit JDK. Could you please check this assumption?

If the issue still actual, kindly provide us with the AInfo report from your machine. To create this report please do the following:

  • Go to the ReceiptCapture SDK installation folder, \Bin\Support;
  • Run the AInfo.exe and wait until the utility gathers all necessary information;
  • Send the generated archive to SDK_Support@abbyy.com.
link

answered 22 Jun '16, 13:22

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦
1.5k16

edited 22 Jun '16, 13:27

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×48
×23
×12
×4
×2

Asked: 13 Jun '16, 23:29

Seen: 1,019 times

Last updated: 10 Mar, 15:10

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal