Skip to content

Instantly share code, notes, and snippets.

@bjoerntx

bjoerntx/test.js Secret

Created July 10, 2023 08:11
Show Gist options
  • Save bjoerntx/baa7006151069fde5c50f76275ccd674 to your computer and use it in GitHub Desktop.
Save bjoerntx/baa7006151069fde5c50f76275ccd674 to your computer and use it in GitHub Desktop.
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