Giter VIP home page Giter VIP logo

node-msoffice-pdf's Introduction

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

node-msoffice-pdf's People

Contributors

skmp avatar

Watchers

gotomypc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.