Text

How to get text iOS

When i draw the "A" letter can i get that text  after recognition for show in my custom UITEXTVIEW in iOS SDK?


Dear Kannan,


currently, you can export your result: https://developer.myscript.com/docs/interactive-ink/1.3/ios/fundamentals/import-and-export/#exporting-content


In order to get the result as text, you should ensure to export it using the TEXT MimeType: http://cocoadocs.org/docsets/MyScriptInteractiveInk-Runtime/1.0.0/Classes/IINKEditor.html#//api/name/export_:mimeType:error:


Before exporting, ensure you call the waitForIdle function: https://developer-support.myscript.com/support/discussions/topics/16000022498


Best regards,


Olivier

Where i can get the content block for the following method?(Export my result)


 editorViewController.editor.export_(<#T##block: IINKContentBlock?##IINKContentBlock?#>, mimeType: <#T##IINKMimeType#>)

Dear Kannan,


currently, you can refer to the "Content blocks" part of our documentation: https://developer.myscript.com/docs/interactive-ink/1.3/ios/fundamentals/editing/#content-blocks


Based on this:

-If you only have a single part (e.g. text), then you can set a null block

-If you have a text document with several part, then you shall get the block you wan to export, and provide it to the export function


Best regards,


Olivier

Hi Olivier,

 I want to clear the one more doubt,If i write the letter "A" and i will give the 5 spaces and then i write the following letters.In this case i want to get the result with the spaces

Ex:if i write the following letters,

A______Script on this page.

Then  i need the result was exact same string what i given with spaces(A_____Script on this page).

Dear Kannan,


currently, if you write "many space", we will not detect the number of spaces that were added, as this would be difficult to interpret. Basically, we will return with one space.


Best regards,


Olivier

Hi Olivier,

Thanks for you quick response.    

 Is there is any possible way to get that words with spaces too?


Dear kannan,


I am not sure to understand. As stated above, we will detect one space, not several.


If this doesn't help, please provide with more explanation.


Best regards,


Olivier

Hi oliver, 

 Thanks for your response,

I have another one doubt "I want to get the positions of an each word (If i write the sentence "They are all good" - i want to get the position(coordinates(X,Y)) of an word "They","are","all" and "good"

Dear Kannan,


to get the position of each word, you need to export as JIIX:

String JIIXExport = editor.export_(null, MimeType.JIIX);


For each word, you will then get the list of candidates and the bounding box (in mms):

     "label": "hello",
"candidates": [ "hello", "bello", "felloe", "Tello", "tello" ],
"bounding-box": {
"x": 15.084015,
"y": 14.584393,
"width": 7.7678337,
"height": 4.1368465
},


Best regards,


Olivier

Hi Olivier,

I want to import my custom text into "Text Document" with particular positon.

I want to put a text ("Dolo 650mg" or assume something) into a "Text Document" with my custom Position(X=30,Y=40)

How can i achieve this feature?

Dear Kannan,


thank you for your question.


The only possibility is to add a text block inside your text document part: editor.addBlock(30,40, "Text", MimeType.TEXT, "Dolo 650mg");


Best regards,


Olivier

Hi Olivier,

Thanks for your response.

Actually i want to put a text into my "TEXT" type part.

When i try to add a text type block  into my "TEXT" part, the following error was throwing,

Domain=Interactive Ink SDK Error Domain Code=1 "Error, -[IINKEditor addBlock:type:mimeType:data:error:]::428 operation not permitted on this block" UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor addBlock:type:mimeType:data:error:]::428 operation not permitted on this block}

My added Text block code was:

 do{

           try editorViewController.editor.addBlock(CGPoint(x: 0, y: 0), type: "Text", mimeType:  .text, data: "Dolo 650mg")

  }

  catch{

          print(error)

 }

How can i solve this issue?


Dear Kannan,


thank you for the update.


Currently, the addBlock can only be done in a "container" block, i.e. a "Text Document" part: https://developer.myscript.com/docs/interactive-ink/1.3/android/fundamentals/editing/#block-management


In a text part, the only way to add a text is to use the import: editor.import_(MimeType.TEXT, "this is a test", null);


Nevertheless, this doesn't  allow to set it at a given position. You then understand your use-case to set a text at a given postion in a text part is not possible. Maybe you could try using a "Text Document" part, or have several fields in your form, and use an editor and a part per field?


Best regards,


Olivier

Hi Olivier,

Thank you for your response.

I tried out both "Text" and "Text Document" part but both are not working in my case.

In "Text" part it doesn't throw any errors but in "Text Document" part it show following error,

Domain=Interactive Ink SDK Error Domain Code=1 "Error, -[IINKEditor addBlock:type:mimeType:data:error:]::428 add block failed: could not create block at (x,y)" UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor addBlock:type:mimeType:data:error:]::428 add block failed: could not create block at (x,y)}

Add Text Block in "Text Document" Part:

do{

       try editorViewController.editor.addBlock(CGPoint(x: 20, y: 20), type: "Text", mimeType:  .text, data: "Dolo 650mg")

 }

 catch{

 print(error)

 }

Add Text Block in "Text" Part:

do{

      try editorViewController.editor.import_(.text, data: "Dolo 650mg", block: nil)

 }

catch{

 print(error)

 }

How can i resolve this?

Login or Signup to post a comment