iink SDK on Device

Export the MATH Part as PNG using iinkSDK

Hi, 

I need to export the "MATH" Part as PNG using iinkSDK.

My export  "MATH" Part code is following there,

if let getImage = try? editorViewControllerMath.editor.export_(editorViewControllerMath.editor.rootBlock, mimeType: IINKMimeType.PNG){

print(getImage)

}

But I didn't get the export Image of my "MATH" Part.

How to resolve this issue?


Dear Kannan,


Currently, as explained in the following page, when exporting as PNG, you need an ImageDrawer: https://developer.myscript.com/docs/interactive-ink/1.4/ios/fundamentals/rendering/#reference-implementation


You can also refer to the following documentation: https://developer.myscript.com/docs/interactive-ink/1.4/ios/fundamentals/import-and-export/#image-drawer


An ObjC sample is also available in the didSelectRowAtIndexPath function of the iink\examples\ios\Demo\Demo\Classes\Export\ExportTableViewController.m file, that shows how to proceed.


Best regards,


Olivier

Hi,

When i try to export the MATH part by following above your reference code, it will throw the following error,

-[IINKEditor export_:toFile:imageDrawer:error:]::532 imageDrawer did not create image: out/export.png

My export MATH part code is following there,

                  let imageLoader = ImageLoader()

                   imageLoader.cacheFolderPath = NSTemporaryDirectory()

                   imageLoader.editor = editorViewControllerRough.editor

                   let imageDrawer = ImageDrawer()

                   imageDrawer.imageLoader = imageLoader


                   do {

                    if let getImage =  try? editorViewControllerMath.editor.export_(editorViewControllerMath.editor.rootBlock, toFile: "out/export.png", imageDrawer: imageDrawer){

                        print(getImage)

 }

                   } catch {

                    print(error)

 }


How to resolve this issue?

Dear Kannan,


this error message simply means you cannot create the "out/export.png" file.


Please use a path where you can save (e.g. the NSTemporaryDirectory: https://stackoverflow.com/questions/17421608/writing-to-tmp-folder-ipad).


Best regards,


Olivier

Login or Signup to post a comment