Skip to content

Module to export Word, Excel & PowerPoint to PDF. Requires windows and installed office 2013

Notifications You must be signed in to change notification settings

skmp/node-msoffice-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Module to export Word, Excel & PowerPoint to PDF. Requires windows and installed office 2013

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published