Browse Source

Added phantomjs scriptfile for easier printing

Manuel Bieh 12 years ago
parent
commit
5868becf84
1 changed files with 27 additions and 0 deletions
  1. 27 0
      js/print-pdf.js

+ 27 - 0
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();
+});