Application Tool Kit

problem with Off screen usage

Hi i am currently developing app with new my script iink sdk 1.2

problem is when I used "Text Document" part

I have nothing for root Block (no children blocks too)

It works great when I work with "Text" part only.

code snippet as follows

            let (events,count) = self.createStrokeEvent(strokes: strokes)

            do {

                let part = try package.createPart("Text Document")

                editor.part = part



                try editor.pointerEvents(events, count: count, doProcessGestures: false)



                guard let rootBlock = editor.rootBlock else {

                    return completion(trans)



Also whenever I attached the image drawer to the block

                        let imgLoader = ImageLoader()

                        imgLoader.cacheFolderPath = NSTemporaryDirectory()

                        imgLoader.editor = editor

                        let imgDrawer = ImageDrawer()

                        imgDrawer.imageLoader = imgLoader

                        try editor.export_(childBlock, toFile: "out/export.docx", imageDrawer: imgDrawer)

I have following error

 Error, -[IINKEditor export_:toFile:imageDrawer:error:]::521 unrecognized file extension

Dear Sam Nam,

currently, it is likely you are getting this error because you cannot export to docx.

Before exporting, we recommend you call the getSupportedExportMimeTypes function:

This way, you know the export formats allowed for your ContentBlock.

Best regards,


Thank you for your response.

Let me clarify my question.

I am using iink engine for off-screen mode (background)

I feed the number of strokes into the engine/editor

** strokes include some text and diagrams and math equations (all handwritten strokes)

when I create part "Text"

I was successfully able to get transcribed text from the raw stroke as follows

 let part = try package.createPart("Text")

                editor.part = part


                try editor.pointerEvents(events, count: count, doProcessGestures: false)


                let rootBlock = editor.rootBlock 

               let str = editor.export_(rootBlock, MimeType.TEXT)

// I have transcribe string at this point

HOWEVER, when I try  


let part = try package.createPart("Text Document") instead of "Text"

For the same strokes (used for "Text" part above), Most of the time, I have empty rootBlock (no children neither data inside.)

As far as I understand from your document ( ), 

I would expect to get multi sud-blocks (as  children of rootBlock)

: some blocks for text and some blocks for diagrams and some for math?

Am I right? 

Dear Sang Nam,

in theory, rootBlock should never be null. If this is the case, please save your content package using the "saveAs" function, and attach it to this post:

Otherwise, in order to have sub-blocks in a "Text Document", you should ensure to add these using the "addBlock" or the "addImage" function. Indeed, no subBlock will "magically" added by the iink.

Best regards,


1 person likes this

Thank you for your prompt reply

I thought your engine automatically classify the type of contents (diagram / text / math) from the raw strokes.

and make it as known "text document"

If I remember correctly. your analyzer (old version before  iink) was able to do this (?)

According to your answer above. I should manually add block for each content type.

For example. If I am developing note-taking app and run myscript in backgroud mode.

User might draw some diagram with some hand written notes on the same page.

and my app should somehow detect which area of the page is for diagram and text and etc.

and manually add them as sub-block to root block ? 

Please correct me if I understood differently

Is there any way that iink engine automatically detects whether it is shape or text directly from raw strokes provided as input?

Thanks for your help!

Dear Sang Nam,

Indeed, when using the MyScript Analyzer, it extracts Text, Shapes and "other" areas, and will convert text and shapes. The iink is not designed this way.

What you could do with the iink is use a "Raw Content" part (, add the strokes, and export these as JIIX. You will get text areas, and you can then add the correspond strokes in a "Text" part and convert these. For the non text areas, maybe you can add these in a "Drawing" or create an image using a third part library and then add this image? This all depends on the "non text" areas you are likely to have. This is more based on your experience.

Best regards,


Login or Signup to post a comment