Import and export

This page drives you through available possibilities to import content into iink SDK or to export it for external usage.

Importing content

You can import data into your myscript-common-element instance.

For example, the following code will import the “Hello iink SDK” text string into a “Text” part:

myscriptCommonElement.import_("Hello iink SDK", "text/plain");

Managed formats are depending on the recognition type of your input.

Importing content is “destructive”: Pre-existing content will be cleared and replaced (except for Text JIIX import).

Math import

Currently, MATH supports only JIIX import.

const jiix = "..."; // string containing the jiix definition
mathComponent.import_(jiix, 'application/vnd.myscript.jiix');

Text plain import

You can import plain/text data in TEXT.

Text JIIX import

JIIX import in TEXT is so far limited to text words candidate changes. More import capabilities will be provided later on.

To change the text candidates within a given Text :

  1. Export the block to the JIIX format.
  2. Replace the label of the target word with another word from the candidates list.
  3. Import the modified JIIX data back to your block.
Importing JIIX data in TEXT is only possible if the target block was not modified since it was exported. For more information, refer to this page.

Raw ink import

To import raw ink pointer events, instantiate an editor and pass it an array of pointer events. Note that in this scenario, except if you are working on a “Drawing” part, the recognition engine will automatically process the new strokes. This approach is documented in the Editing part of this guide.

Exporting content

By default, an exported event is fired every time some content is recognized on the server side. The event is shaped like in the example below.

{
  detail : {
    rawResult : {
      type:"exported",
      partId:"xdyygiil",
      exports:{"text/plain":"mycontent"}
    }
  }
  ...
}

If you want to override the default behavior and if you are willing to export “on demand” (by calling the export_() method), you have to set

the ondemand attribute to your myscript-common-element tag.

Exporting content

By default, an exported event is fired by the web component every time some content is recognized on the server side. The event is shaped like in the example below.

{
  detail : {
    rawResult : {
      type:"exported",
      partId:"xdyygiil",
      exports:{"text/plain":"mycontent"}
    }
  }
  ...
}

As previously explained, if you want to export “on demand” (by calling the exportContent() method), you have to set the ondemand attribute to your myscript-common-element tag.

You can override the default exported mime-types by setting in JavaScript the configuration attribute with the mime types you want to export in an array at path recognitionParams.v4.math.mimeTypes for MATH or recognitionParams.v4.text.mimeTypes for TEXT. The export mime-types depends on the type of content part you have configured.

mime-type content part type
application/vnd.myscript.jiix: JSON interactive ink format containing the strokes MATH and TEXT
application/x-latex: The famous LATEX format MATH
text/html: Export the content as a HTML with all content online (non typeset strokes included) TEXT
text/plain: Export the content as a plain text. TEXT

Supported imports/exports

Exchange format

Interactive Ink SDK defines its own format, called JIIX (short for JSON Interactive Ink eXchange format).

This format provides a consistent representation of the different types of content that are supported, covering semantics, positions, styling and ink-related aspects.

Thanks to its JSON syntax, it stays readable and can be easily parsed, making it appropriate to exchange information with the host application or as a transitory representation to support custom export formats.

The complete JIIX reference can be found here.

Other formats

Interactive Ink SDK allows you to import and export some commonly used formats, such as LaTeX for math content or Docx in the case of Text Document blocks.

The full list can be found here.

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