iink SDK on Device

Answered

Support to export multiple files at a time

In Interactive Ink SDK is there a provision to export an array of files.
If yes can you guide us.


Best Answer

Dear FIGMD,

Currently, to ensure a package is closed, you shall ensure the following:
-Before closing anything, ensure the recognition is finished: editor.waitForIdle();
-Close and release the parts:
contentPart.close();
contentPart = null;

-Close and release the packages:
contentPackage.close();
contentPackage = null;


Your content packages should then be closed properly. If trying to re-open these, you should no longer have the "Package already opened" error.

Best regards,

Olivier


Dear Flgmd,


thank you for contacting us.


Currently, we are not sure to understand your request.


What is the purpose of your application? Which files do you want to export using the iink SDK?


We are not sure to understand your request. Please explain.


Best regards,


Olivier

Hello Olivier,

Suppose we have 3 "Drawing" Part Types that means we now have 3 Files, so when the function export_() is triggered from the class "DocumentController.java", can we get all the 3 Files so that i can save them to the phone's external storage?

Thanks and Regards
FIGMD India

image

image

image

Dear FIGMD,

currently you have several possibilities:
1-Either you have one editor, and add 3 "Drawing blocks": https://developer.myscript.com/docs/interactive-ink/1.3/android/fundamentals/editing/#content-blocks.
Then, for each block, you can export it: https://developer.myscript.com/refguides/interactive-ink/android/1.3/com/myscript/iink/Editor.html#export_-com.myscript.iink.ContentBlock-java.io.File-com.myscript.iink.MimeType-com.myscript.iink.IImageDrawer-

2-Or, you create 3 editors, 3 "Drawing" parts, and for each part you assign it to an editor. Each editor can then be exported.

Best regards,

Olivier

Hello Olivier,

Thank you for the reply. I will try out the above 
possibilities.
Also is there a way to delete a part completely and invalidate the editor?

Regards
FIGMD India

Dera FIGMD,


currently, to delete a part, you can refer to the onDestroy function of the MainActivity.java in the getstarted code sample.


For the editor, you can refer to the close function of EditorView.java file.


Best regards,


Olivier


Hello Olivier,

Thank you for the reply.

I have one more query: Can we restrict the size of the image(ie. height and width) to an A4 size paper without compromising its quality?

Regards
FIGMD India

Dear FIGMD,


currently, I recommend you refer to the prepareImage function of the ImageDrawer.java file:

@Override
public void prepareImage(int width, int height)
{
if (bitmap != null)
  {
bitmap.recycle();
bitmap = null;
  }
canvas = null;

bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
canvas = new android.graphics.Canvas(bitmap);
}


When calling the latter, you set the width and height of the image you want to export. You can also see the exported image is in bitmap.


Best regards,


Olivier

Hello Olivier,

Thank you for the reply.

Even if i call the close() function still i get the exception as "Package already opened"

inside newPackage() of DocumentController.java


Regards
FIGMD India

Answer

Dear FIGMD,

Currently, to ensure a package is closed, you shall ensure the following:
-Before closing anything, ensure the recognition is finished: editor.waitForIdle();
-Close and release the parts:
contentPart.close();
contentPart = null;

-Close and release the packages:
contentPackage.close();
contentPackage = null;


Your content packages should then be closed properly. If trying to re-open these, you should no longer have the "Package already opened" error.

Best regards,

Olivier