Passing bytearray to HTMLviewer

I am using a third party Javascript PDFViewer. This is a local desktop app. I am only using the HTMLViewer because the PDFViewer that has the features I need is Javascript based. (I have looked at the MonkeyBread viewer but I need more native PDF features than it provides). Due to browser security restrictions, I can’t load a local file path in the HTMLviewer. I have to get a byte array of the file from the XOJO App side and send it to the PDFViewer in the HTMLViewer control.

What is the best method to pass the file byte array to a JavaScript I execute in the HTMLViewer to load the document?

Thanks

Pass it base64 encoded and decode in JavaScript.

Sorry, I am a noob to CrossPlatform/XOJO, Javascript etc. I am an old VB.Net guy. If my control is loaded in the viewer, what call do I use to pass Bytearray to the HTMLViewer? MonkeyBread or native XOJO? Which method call? Thank you for your reply!

I want to pass it to a Javascript function.

Please see blog article: HTMLViewer JavaScript communication for Xojo
This shows the ways to run JavaScript.

Hello Simon,

You would need to do something like this:

https://storage.googleapis.com/charlierobin-1245.appspot.com/downloads/base64_image_to_html_viewer.zip

That’s really just the bare bones of the thing, but I think it outlines the basic principles involved. (Only tested on my Mac.)

Regards

Charlie