WordDocument document = WordDocument.Load(stream, GetFormatType(type.ToLower()));
string sfdt = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
return sdft;
var form = document.createElement("form");
form.setAttribute('method', "post");
form.setAttribute('encType', "multipart/form-data");
var outputFileName = document.createElement("input");
outputFileName.type = "hidden";
outputFileName.name = "outputFileName";
outputFileName.value = "filename.pdf";
form.appendChild(outputFileName);
var outputFormat = document.createElement("input");
outputFormat.type = "hidden";
outputFormat.name = "outputFormat";
outputFormat.value = "pdf";
form.appendChild(outputFormat);
// save the document as blob
documentEditor.saveAsBlob('Docx').then(function (exportedDocument) {
//create a form and using existing fields
var formData = new FormData(form);
// send the file name
formData.append('fileName', 'sample.docx');
// send the blob
formData.append('data', exportedDocument);
fetch(form.action, {
method: form.method,
body: formData
}).then(function (res) {
if (!res.ok) {
console.log('something unexpected happened')
}
res.text().then(function (text) {
console.log(text);
})
})
}); |