Created
February 6, 2024 10:56
-
-
Save bjoerntx/d2296927bb2dacdd20815b547c1f7b71 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); | |
SignatureSettings signatureSettings = new SignatureSettings() | |
{ | |
OwnerName = "John Doe", | |
RedirectUrlAfterSignature = this.BasePath + "Signature/SignDocument", | |
UniqueId = Guid.NewGuid().ToString(), | |
SignerName = "Jane Doe", | |
SignatureBoxes = new SignatureBox[] | |
{ | |
new SignatureBox("txsign") | |
{ | |
Style = SignatureBox.SignatureBoxStyle.Signature | |
} | |
}, | |
ShowSignatureBar = true | |
}; | |
// invoke the JS function 'loadDocument' to load back to the modified document | |
_txdocumentviewer?.InvokeVoidAsync("loadDocument", new object[] { Convert.ToBase64String(bDocument), filename, BasePath, signatureSettings }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment