Text

Answered

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?


Best Answer

Dear Kannan,


did you try changing the font-size parameter: https://developer-support.myscript.com/support/discussions/topics/16000026063 ?


Let us know if this helps.


Best regards,


Olivier


Dear Kannan,


currently, we have no easy way for such use-case. Indeed, export shall be done when starting a new line, which is difficult to achieve.


Or you could detect by yourself when starting a new line (e.g. new stroke is "far left" from the previous stroke and "below enough" from the previous one), and call the export function. But this may be difficult to implement.


Best regards,


Olivier

Hi Olivier,

Thanks for your response.

I have already achieved what you are told?(Export function)

But actually my need was when i completed the first line and then i go to a second line the first line drawings are convert into "TEXT" type(Export that all letters and import that letters into the first line).But second line is still in the drawing mode till i have to go to the third line.

How can i achieve that?

Dea Kannan,


this may be done as follows:

-At each penUP, you call the export function (e.g. using the JIIX or TEXT MimeType)

-You then have the result, which you can update in your TEXT display view.


Let us know if this helps.


Best regards,


Olivier

Hi Oliver,

Thanks for your response.

I want to convert my draw letter into the "text" in writing area while i am continuously writing.

Ex:

I have to write the sentence "Dolo 650mg".First i write the word "Dolo".It was converted into text instead of my drawing word "Dolo" while i write the next word "650mg"

I want my words are continuously convert into "Text" in writing area while i am writing word by word.(Simultaneously convert and writing)

Is that possible in MyScript SDK?If its possible how can i achieve that?

Dear Kannan,


did you try tuning the text styling parameters:
https://developer.myscript.com/docs/interactive-ink/1.3/reference/styling/#text


Let us know if this helps.


Best regards,


Olivier

Hi Olivier,

Thanks for your response.

Now i can import successfully in both "Text" and "Text Document" part.

But imported text size was too large.Can i change that imported text's Size and Color?

Hi Olivier,

Thanks for your response.

Now i can import successfully in both "Text" and "Text Document" part.

But imported text size was too large.Can i change that imported text's Size and Color?

Dear Kannan,


you can refet to the following topic, that explains how to set an eraser: https://developer-support.myscript.com/support/discussions/topics/16000026208


Best regards,


Olivier

Hi Olivier,

I have one more doubt, is there is default delete button in editor engine?

You provide the default delete button was inside the editor engine?

Hi Olivier,

Thanks for your response.

Now i can import successfully in both "Text" and "Text Document" part.

But imported text size was too large.Can i change that imported text's Size and Color?




Dear kannan,


The "could not create block at (x,y)" error message means there is not enough space to add the block.


Basically, if trying to add it, you should ensure there is "enough space" around the position you are providing to the addBlock function. Also, keep in mind the iink will not move existing blocks.

Indeed, the iink will try to add the block around the position you are providing, and if there is not the necessary space, it will fail.


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?

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,

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