node-msoffice-pdf

0.0.7 • Public • Published

node-msoffice-pdf

Uses edge.js + a bit of C# code to export office documents as pdfs, using Office remoting.

Depends on office 2013 + windows.

Installation

npm install node-msoffice-pdf

Usage

var msopdf = require('node-msoffice-pdf');
 
msopdf(null, function(error, office) { 
 
    if (error) { 
      console.log("Init failed", error);
      return;
    }
 
   /*
     There is a queue on the background thread, so adding things is non-blocking.
   */
 
   office.word({input: "infile.doc", output: "outfile.pdf"}, function(error, pdf) { 
      if (error) { 
           /* 
               Sometimes things go wrong, re-trying usually gets the job done
               Could not get remoting to repiably not crash on my laptop
           */
           console.log("Woops", error);
       } else { 
           console.log("Saved to", pdf);
       }
   });
 
 
   office.excel({input: "infile.xlsx", output: "outfile.pdf"}, function(error, pdf) { 
       if (error) { 
           console.log("Woops", error);
       } else { 
           console.log("Saved to", pdf);
       }
   });
 
 
   office.powerPoint({input: "infile.pptx", output: "outfile.pdf"}, function(error, pdf) { 
       if (error) { 
           console.log("Woops", error);
       } else { 
           console.log("Saved to", pdf);
       }
   });
 
   /*
     Word/PowerPoint/Excel remain open (for faster batch conversion)
 
     To clean them up, and to wait for the queue to finish processing
   */
 
   office.close(null, function(error) { 
       if (error) { 
           console.log("Woops", error);
       } else { 
           console.log("Finished & closed");
       }
   });
});

Contributing

Github for issues & PR, MIT license, yada yada

Release History

  • 0.0.7 Rly works nao
  • 0.0.5 ...
  • 0.0.4 Update README.md (x2)
  • 0.0.3 Update README.md
  • 0.0.2 (Mostly?) working prototype

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.7
    102
    • latest

Version History

Package Sidebar

Install

npm i node-msoffice-pdf

Weekly Downloads

102

Version

0.0.7

License

MIT

Last publish

Collaborators

  • skmp