I need to convert doc/docx to html. I have files stored in Amazon s3. I need to view & edit it in browser. Right now, I am using Apache POI to convert doc/docx to html. And I am displaying the response on HTML editor(Jquery Plugin). It works but alignment/format changes. Also images not extracted. Any solution to fix image extraction & formatting issues, please refer or refer any Jquery/JS plugin for conversion.
Doing a quick Google Search, I found these libraries: (I have not used, nor endorsed any of these)
docx2html basic functionality:
var docx2html=require('docx2html')
docx2html(fileInput.files[0],{container:document.getElementById('a')}).then(function(html){
html.toString()
})
mammoth basic functionality:
var mammoth = require("mammoth");
mammoth.convertToHtml({path: "path/to/document.docx"})
.then(function(result){
var html = result.value; // The generated HTML
var messages = result.messages; // Any messages, such as warnings during conversion
})
.done();
I hope this was, at least, useful
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With