Search code examples
javascriptioshtmlphonegap-pluginsdevextreme

MHT DocumentViewer for HTML5/JS Mobile Application


I am developing a Mobile Application (primary for iPhone/iOS) with HTML5/JS (with the DevExtreme-Package from DevExpress). Now, I need to display the content of MHT-Files in this Application. For this I am searching for a document viewer which can display MHT-Files.

Optimal would be, if the control cannot only display MHT-Files rather the user can edit the content.

Can someone help me, how can I do that? Perhaps would it be possible to use a web-browser-control to view it?


Solution

  • MHT or Mime HTML is an archive format... so you should be able to convert to HTML then back to .mht...

    You should be able to use https://github.com/zsxsoft/mhtml-parser to parse mht...

    let parser = require('mhtml-parser');
    parser.loadFile(__dirname + "/simple/simple.mht", {
      charset: "gbk" 
    }, function(err, data) {
      if (err) throw err;
        console.log(data);
    });
    

    You should then be able to modify the file contents then you need to convert it back to mht which I'm not sure if above mentioned repo can do, Still you should be able to reverse engineer and create for yourself html to mht converter, when you do consider making it open source, so other people can use it... ;-)

    I haven't used this personally, but it's got six stars... and seems to be most popular repo for this work...

    Alternatively... You can search mht on github to find more candidates suitable for the job ;-)