summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorManuel Bieh2012-12-15 16:00:25 +0100
committerManuel Bieh2012-12-15 16:00:25 +0100
commit5868becf84ee9983360882dcb9178c9970286639 (patch)
treed2d064bc43a2efde124d8a14b8da0bf8a24d66b1
parent519ee26809bfd6bd824155e999d2c9eaae6786bb (diff)
Added phantomjs scriptfile for easier printing
-rw-r--r--js/print-pdf.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/print-pdf.js b/js/print-pdf.js
new file mode 100644
index 0000000..c22264c
--- /dev/null
+++ b/js/print-pdf.js
@@ -0,0 +1,27 @@
+// html2pdf.js
+var page = new WebPage();
+var system = require("system");
+
+page.paperSize = {
+ format: "A4",
+ orientation: "landscape",
+ margin: {
+ left:"0",
+ right:"0",
+ top:"0",
+ bottom:"0"
+ }
+};
+page.zoomFactor = 1.5;
+
+var revealFile = system.args[1] || 'index.html?print-pdf';
+var slideFile = system.args[2] || 'slides.pdf';
+
+if(slideFile.length - 4 != slideFile.lastIndexOf('.pdf')) {
+ slideFile += '.pdf';
+}
+
+page.open(revealFile, function (status) {
+ page.render(slideFile);
+ phantom.exit();
+}); \ No newline at end of file