forked from skmp/node-msoffice-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make this almost usable as npm module
- Loading branch information
Showing
7 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
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(office) { | ||
|
||
/* | ||
There's a queue on the background thread on C#, 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("Finished & closed"); | ||
} else { | ||
console.log("Saved to", pdf); | ||
} | ||
}); | ||
}); | ||
|
||
## Contributing | ||
|
||
Github for issues & PR, MIT license, yada yada | ||
|
||
## Release History | ||
|
||
* 0.0.2 (Mostly?) working prototype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var edge = require('edge'); | ||
|
||
module.exports = edge.func({ | ||
source: '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', | ||
'C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Office.Interop.PowerPoint\\15.0.0.0__71e9bce111e9429c\\Microsoft.Office.Interop.PowerPoint.dll', | ||
'C:\\Windows\\assembly\\GAC_MSIL\\Office\\15.0.0.0__71e9bce111e9429c\\Office.dll', | ||
'C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Vbe.Interop\\15.0.0.0__71e9bce111e9429c\\Microsoft.Vbe.Interop.dll' | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
"version": "0.0.1", | ||
"description": "Saves docs as pdfs", | ||
"author": "Stefanos Kornilios Mitsis Poiitidis ([email protected])", | ||
"main": "lib.js", | ||
"scripts": { | ||
"test": "node testrunner.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/skmp/node-msoffice-pdf" | ||
|
@@ -12,8 +16,10 @@ | |
"pdf" | ||
], | ||
"dependecies": { | ||
"edge" : "*", | ||
"node-uuid" : "*" | ||
"edge" : "*" | ||
}, | ||
"devDependencies": { | ||
"node-uuid" : "*" | ||
} | ||
"license": "MIT" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters