iink SDK Web

Answered

Rest method gives two results when exported

I've been using REST in iinkjs and every time I export, it will give two results. The first text/plain result is "undefined" or the previous export result and the second text/plain result is the result I've been looking for. I'm new to using this and still reading the documentation. If it helps, this is my configuration for my setup:   

$('.editor').each(function(index, editorElement) {
    iink.register(editorElement, {
        triggers: {
          exportContent: 'DEMAND',
          addStrokes: 'QUIET_PERIOD'
        },
        recognitionParams: {
            type: 'TEXT',
            protocol: 'REST',
            server: {
                scheme: 'https',
                host: 'webdemoapi.myscript.com',
                applicationKey: applicationKey,
                hmacKey: hmacKey
            },
            iink: {
              lang: 'ja_JP'
            }
        },
    });
})

  Thank you.

 


Best Answer

Dear Mark,


Thank you for your question.


The default configuration for TEXT recognition contains two MIME types: the text/plain and the application/vnd.myscript.jiix that correspond to our internal JIIX format.

This later format allows iinkJS retrieving addition information than plain text, such as words bounding box, and word candidates. For this reason it is activated by default.

And this is the reason why you have two results.


If you want to override the default configuration to only use the plain text, you should update you configuration with following parameters:


    iink.register(editorElement, {
        triggers: {
          exportContent: 'DEMAND',
          addStrokes: 'QUIET_PERIOD'
        },
        replace: true,
        recognitionParams: {
            type: 'TEXT',
            protocol: 'REST',
            server: {
                scheme: 'https',
                host: 'webdemoapi.myscript.com',
                applicationKey: applicationKey,
                hmacKey: hmacKey
            },
            iink: {
              lang: 'ja_JP',
              text: {
                          mimeTypes: ['text/plain']
              }
            }
        },


Best regards,


Gwenaëlle


Answer

Dear Mark,


Thank you for your question.


The default configuration for TEXT recognition contains two MIME types: the text/plain and the application/vnd.myscript.jiix that correspond to our internal JIIX format.

This later format allows iinkJS retrieving addition information than plain text, such as words bounding box, and word candidates. For this reason it is activated by default.

And this is the reason why you have two results.


If you want to override the default configuration to only use the plain text, you should update you configuration with following parameters:


    iink.register(editorElement, {
        triggers: {
          exportContent: 'DEMAND',
          addStrokes: 'QUIET_PERIOD'
        },
        replace: true,
        recognitionParams: {
            type: 'TEXT',
            protocol: 'REST',
            server: {
                scheme: 'https',
                host: 'webdemoapi.myscript.com',
                applicationKey: applicationKey,
                hmacKey: hmacKey
            },
            iink: {
              lang: 'ja_JP',
              text: {
                          mimeTypes: ['text/plain']
              }
            }
        },


Best regards,


Gwenaëlle


1 person likes this

I can't see the results now because I already reached the free quota. But this configuration only produces one post error so I think this is working. Thank you very much for your help.

Login or Signup to post a comment