Interactive Ink

Answered

PROBLEM WITH EXPORTING PPTX

I integrated iink into iOS (swift app)


here is my code snippet 


            guard let editor = self.createEditor(viewSize: CGSize(width: 640, height: 480), locale: locale) else { return  }

            guard let package = self.createPackage() else { return  }


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

            do {

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

                editor.part = part

                try editor.configuration.setBoolean(false, forKey: "diagram.enable-sub-blocks")

                editor.clear()

 

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

                editor.waitForIdle()

 

                guard let rootBlock = editor.rootBlock else {

                    return completion(trans)

 }

 

                let supportedMimeTypes = editor.getSupportedExportMimeTypes(rootBlock)

                for type in supportedMimeTypes {

                    print("support type ==> \(self.mimeTypeName(type: type.value))")

 }

                print("number of child: \(rootBlock.children.count)")

 

                let imgLoader = ImageLoader()

                imgLoader.cacheFolderPath = NSTemporaryDirectory()

                imgLoader.editor = editor

                let imgDrawer = ImageDrawer()

                imgDrawer.imageLoader = imgLoader


                let rnd = Utils.generateUniq(length: 3).lowercased()

                let fn = NSTemporaryDirectory().appending("out/export_" + rnd + ".pptx")

                try editor.export_(rootBlock, toFile: fn, mimeType: IINKMimeType.PPTX, imageDrawer: imgDrawer)

// trans = try editor.export_(rootBlock, mimeType: IINKMimeType.JPEG)



1. I created "Diagram" part

2. added some raw stroke data.

3. checked supported export types 

-it shows that

support type ==> SVG

support type ==> GRAPH_ML

support type ==> JIIX

support type ==> PPTX

support type ==> MS_OFFICE_CLIP_BOARD

support type ==> JPEG

support type ==> PNG


I can SUCCESSFULLY export SVG, GRAPH_ML, JIIX.

BUT

when I try to export PPTX, it gives me following error

Error Domain=Interactive Ink SDK Error Domain Code=0 "Error, -[IINKEditor export_:toFile:mimeType:imageDrawer:error:]::536 NO_SUCH_FILE" UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor export_:toFile:mimeType:imageDrawer:error:]::536 NO_SUCH_FILE}


or when I use try editor.export_(rootBlock, mimeType: IINKMimeType.JPEG) this api

it always return just "PK" string.


Can you tell me what i am missing in my code? and provide some sample code for how to export in pptx file ?


Regards

Sean







Best Answer

solved

the problem was in creating a folder.



Dear Sang Nam,


thank you for the update, I am glad it is solved.


Indeed, directory has to be created, our SDk will not create it, it will only create the file.


Best regards,


Olivier

Answer

solved

the problem was in creating a folder.