print-pdf.js 508 B

123456789101112131415161718192021222324252627
  1. // html2pdf.js
  2. var page = new WebPage();
  3. var system = require("system");
  4. page.paperSize = {
  5. format: "A4",
  6. orientation: "landscape",
  7. margin: {
  8. left:"0",
  9. right:"0",
  10. top:"0",
  11. bottom:"0"
  12. }
  13. };
  14. page.zoomFactor = 1.5;
  15. var revealFile = system.args[1] || 'index.html?print-pdf';
  16. var slideFile = system.args[2] || 'slides.pdf';
  17. if(slideFile.length - 4 != slideFile.lastIndexOf('.pdf')) {
  18. slideFile += '.pdf';
  19. }
  20. page.open(revealFile, function (status) {
  21. page.render(slideFile);
  22. phantom.exit();
  23. });