# 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 MyScriptJS instance.

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

editor.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.

### 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

configuration.triggers.addStrokes to 'QUIET_PERIOD' when creating the editor.

You can also configure 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.

If you’re using the REST mode, note that only one mime-type will be use per call. However, we will proceed to call the server for each mime-type specified.

## 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.