-
-
Save bjoerntx/baa7006151069fde5c50f76275ccd674 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
function loadDocument(document) { | |
TXTextControl.addEventListener("textControlLoaded", () => { | |
blobToBase64(document, (encoded) => { | |
TXTextControl.loadDocument(TXTextControl.StreamType.InternalUnicodeFormat, encoded); | |
}); | |
}); | |
} | |
function blobToBase64(blob, callback) { | |
var reader = new FileReader(); | |
reader.onload = function() { | |
callback(reader.result.split(',')[1]); | |
}; | |
reader.readAsDataURL(blob); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment