Created
January 29, 2024 11:24
-
-
Save bjoerntx/a00c6afca2e64c5ac951161124fd49c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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