Created
January 30, 2023 14:20
-
-
Save bjoerntx/b434ba906c59d3258e94c3ca91904072 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 saveDocument() { | |
// save document | |
TXTextControl.saveDocument(TXTextControl.StreamType.AdobePDF, function (e) { | |
// create temporary link element | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:application/octet-stream;base64,' + e.data); | |
element.setAttribute('download', "results.pdf"); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
// simulate click | |
element.click(); | |
// remove the link | |
document.body.removeChild(element); | |
}); | |
} | |
function loadDocument() { | |
const htmlDocument = "<p>Hello <strong>World!</strong></p>"; | |
TXTextControl.loadDocument(TXTextControl.StreamType.HTMLFormat, | |
window.btoa(htmlDocument)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment