Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
panelIconIdatlassian-info
panelIcon:info:
bgColor#E6FCFF

You might receive custom files of type .any and .ale from Anyline which are tailored to your specific requirements. Our custom format .ale and .any files are encrypted resource files containing the instructions for processing your custom use.

This article gives step-by-step instructions showing the configuration in an Android activity.

...

How to Configure the Custom .any and .ale Files

There are basically 2 ways to configure custom .any- and -.ale- files. :

  • The first one is via code (using methods in an Android activity)

...

  • .

  • The second one is declarative by extending the View Configuration.

This knowledge base article gives step-by-step instructions showing the configuration in an Android activity.

Info

The example shown below describes an OCR configuration. Custom .any- and .ale files can be implemented for other use cases as well. In this case please use the corresponding Anyline Config classes.

  1. Copy the the .alefile to the folder app/src/main/assets of your app.

  2. Check if there is a folder called app/src/main/trained_models. If it does not exist, create this folder.

  3. Copy the .any file to the newly created folder app/src/main/trained_models.

  4. Add the following statements to your Android activity:

    Code Block
    languagejava
    ...
    private ScanView scanView;
    private OcrScanViewPlugin scanViewPlugin;
    io.anyline.plugin.ocr.AnylineOcrConfig anylineOcrConfig;
    ...
    
    scanView = findViewById(R.id.scan_view);
    ...
    // this is one way to set the view configuration file:
    try {
        scanView.init("your_view_configuration_file.json");
    } catch (Exception e) {
        e.printStackTrace();
    }    
    ...
    anylineOcrConfig = new AnylineOcrConfig();
    ...
    anylineOcrConfig.setCustomCmdFile("your_custom_file.ale");
    anylineOcrConfig.setModel("your_custom_file.any");
    // add further config settings
    ...
    scanViewPlugin = new OcrScanViewPlugin(getApplicationContext(), 
            anylineOcrConfig, scanView.getScanViewPluginConfig(), "OCR");
    ...  
    scanView.setScanViewPlugin(scanViewPlugin);