Interactive Ink runtime

This page shows you how to instantiate the iink runtime and configure it to fit your needs.

Engine creation

The iink SDK runtime is represented by an IINKEngine object.

This object will let you create other key objects, configure the recognition and fine-tune the SDK behavior.

Here is how to instantiate it:

NSData *certificateData = [NSData dataWithBytes:myCertificate.bytes length:myCertificate.length];
IINKEngine *engine = [[IINKEngine alloc] initWithCertificate:certificateData];
Data provided in parameter corresponds to your activation certificate. If engine creation fails, please make sure that it was generated for your application identifier.


A new engine must be configured to let iink SDK know which kind of content is to be recognized.

Being a flexible toolkit, iink SDK also comes with many configuration parameters. While the default values make sense in most cases, it may sometimes be required to configure them to suit your needs.

Accessing the configuration

The configuration can be obtained via the configuration property of the IINKEngine object.

It is possible to attach a delegate implementing the IINKConfigurationDelegate protocol to a given configuration object to get notified when configuration changes are made.

Reading and writing configuration parameters

Interactive Ink SDK configuration is an IINKParameterSet object. It can be seen as a set of key/value pairs, where values themselves can be other IINKParameterSet objects.

You can read the value attached to an existing key, add new (key, value) pairs or remove existing ones. Supported value types are strings, numbers, booleans, arrays of strings, as well as other IINKParameterSet objects.

Here is a representation of such a structure:

  "name": "iink SDK",
  "interactive": true,
    "major": 1,
    "minor": 0
  "parts": [ "text", "math", "diagram", "drawing", "text document"]

The code below shows how to manipulate this structure when stored in a parameters variable:

// Access a section content
IINKParameterSet *version = [parameters getSectionForKey:@"version" error:nil];

// Read a value for a key using the section object
double major = [version getNumberForKey:@"major" error:nil]; /* -> 1 */

// Set a value for a key using the dot syntax
[parameters setNumber:major + 1 forKey:@"version.major" error:nil]; /* -> 2 */

Configuring the recognition

To recognize math, diagrams or text in any language, it is required to provide the engine with configuration files (*.conf) that specify required parameters and recognition assets to be loaded.

Interactive Ink SDK default configurations should be suitable for most needs.

The engine should be configured as follows:

  1. Set the value of the key to the folder(s) containing the configuration files you need.
  2. Set the value of the lang key to match the name of the configuration file that corresponds to the language you want to recognize (for instance, set it_IT for the Italian language, as corresponding resources are described in it_IT.conf).
// Get the configuration object
IINKConfiguration *configuration = self.engine.configuration;

// Set the recognition resources path
NSString *configurationPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"recognition-assets/conf"];
[configuration setStringArray:@[ configurationPath ] forKey:@"" error:nil];

// Set the language
[configuration setString:@"it_IT" forKey:@"lang" error:nil];
MyScript language names starts with a two-letter language code (using the ISO-639 standard), followed by an underscore and a two-letter country code (using the ISO-3166 standard). For example en_US for US English.

Packs for additional languages or content types can be downloaded from MyScript Developer Portal.

If you need to go further, you can learn how to modify or write your own configuration files (advanced).

Configuration files refer to binary files called resources (*.res) that host everything that the engine requires for the recognition. Make sure to properly deploy these files along your application as well. A good practice is to implement error management at editor level to be notified of recognition configuration error.

Content-specific configuration

Interactive Ink SDK comes with many configuration options. Some are general, like the ability to choose the location of the temporary folder to store work data on the file system, and some depend on the type of content you manipulate. For instance, it is possible to activate or deactivate the solver for math equations.

The full list of supported configuration options can be found in the dedicated section.

Editor-level configuration

Engine-level configuration corresponds to the default, global configuration. It is possible to override configuration values at editor-level, which is useful if you manage several parts with different configurations.

Back to the example

To be able to recognize math, the engine of the example calculator needs to be created and pointed to the required assets. The easy way is to rely on the default configuration for math: You just need to set the right configuration option to the folder where the math.conf file provided with iink SDK is located.

In addition, it is recommended to provide a valid content-package.temp-folder configuration, which is further explained in the next step.

The solver component of the math back-end needs to be enabled, so that it can handle the computations when doing the conversion. The value of math.solver.enable is true by default, so there is nothing to do here.

Finally, for the sake of the example, you can change the floating point precision of the answer to 2 digits (it is 3 by default).

The code to create and configure the engine will thus be:

@property (strong, nonatomic) IINKEngine *engine;

- (void)viewDidLoad
  [super viewDidLoad];

  // Create the engine
  NSData *certificateData = [NSData dataWithBytes:myCertificate.bytes length:myCertificate.length];
  self.engine = [[IINKEngine alloc] initWithCertificate:certificateData];

  // Get the configuration object
  IINKConfiguration *configuration = self.engine.configuration;

  // Set the recognition resources path
  NSString *configurationPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"recognition-assets/conf"];
  [configuration setStringArray:@[ configurationPath ] forKey:@"" error:nil];
  // Set the temporary directory
  [configuration setString:NSTemporaryDirectory() forKey:@"content-package.temp-folder" error:nil];

  // Set the math fractional part precision
  [configuration setNumber:2 forKey:@"math.solver.fractional-part-digits" error:nil];

At this point, the engine is theoretically able to recognize math. The next step of this guide will show how to load and save content.

We use cookies to ensure that we give you the best experience on our website Read the privacy policy