From 45f4a905d214bc19e6624655d3cd06936fad3afc Mon Sep 17 00:00:00 2001 From: Stefanos Kornilios Mitsis Poiitidis Date: Tue, 25 Nov 2014 08:30:56 +0100 Subject: [PATCH] Fix Readme, office, path --- README.md | 32 +++++++++++++++++++------------- lib.js | 3 ++- office.cs | 1 - package.json | 3 ++- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 240f38f..0ca9dcc 100644 --- a/README.md +++ b/README.md @@ -14,25 +14,30 @@ Depends on office 2013 + windows. ```ruby var msopdf = require('node-msoffice-pdf'); -msopdf(null, function(office) { +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 reliably not crash on my laptop + 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); @@ -40,8 +45,8 @@ msopdf(null, function(office) { console.log("Saved to", pdf); } }); - - + + office.powerPoint({input: "infile.pptx", output: "outfile.pdf"}, function(error, pdf) { if (error) { console.log("Woops", error); @@ -49,18 +54,18 @@ msopdf(null, function(office) { 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("Finished & closed"); + console.log("Woops", error); } else { - console.log("Saved to", pdf); + console.log("Finished & closed"); } }); }); @@ -73,7 +78,8 @@ msopdf(null, function(office) { ## Release History -* 0.0.4 Fix package.json +* 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 diff --git a/lib.js b/lib.js index fa43f78..9f573fd 100644 --- a/lib.js +++ b/lib.js @@ -1,7 +1,8 @@ var edge = require('edge'); +var path = require('path'); module.exports = edge.func({ - source: 'office.cs', + source: path.join(path.dirname(module.filename), 'office.cs'), references: [ 'C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Office.Interop.Word\\15.0.0.0__71e9bce111e9429c\\Microsoft.Office.Interop.Word.dll', 'C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Office.Interop.Excel\\15.0.0.0__71e9bce111e9429c\\Microsoft.Office.Interop.Excel.dll', diff --git a/office.cs b/office.cs index e369d3a..3b8330b 100644 --- a/office.cs +++ b/office.cs @@ -168,7 +168,6 @@ public async Task powerPoint(dynamic opts) { private void closeInternal() { Delay(4); - Console.WriteLine("Time to quit now ..\n"); if (msword != null) { try { diff --git a/package.json b/package.json index 582699f..71454d5 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "node-msoffice-pdf", - "version": "0.0.5", + "version": "0.0.7", "description": "Exports various microsoft office formats to pdfs", "author": "Stefanos Kornilios Mitsis Poiitidis (skmp@nillware.com)", + "files": [ "office.cs", "lib.js" ], "main": "lib.js", "scripts": { "test": "node testrunner.js"