Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 29, 2024 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/a00c6afca2e64c5ac951161124fd49c6 to your computer and use it in GitHub Desktop.
Save bjoerntx/a00c6afca2e64c5ac951161124fd49c6 to your computer and use it in GitHub Desktop.
[JSInvokable("LoadDocumentFromFile")]
public void LoadDocumentFromFile(string filename)
{
// check if the file exists
if (!System.IO.File.Exists(filename))
{
return;
}
// load the file into a byte array
byte[] bDocument = System.IO.File.ReadAllBytes(filename);
// invoke the JS function 'loadDocument' to load back to the modified document
_txdocumentviewer?.InvokeVoidAsync("loadDocument", new object[] { Convert.ToBase64String(bDocument), filename });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment