-
-
Save mschultheiss83/7027af038df1edc191f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * @author Mickaël Andrieu <[email protected]> | |
| * @licence MIT | |
| * Usage: casperjs casperPDF.js "[url]" [filename.<format>] | |
| */ | |
| var casper = require('casper').create({ | |
| pageSettings: { | |
| paperSize: { | |
| format: "Letter", | |
| orientation: "portrait", | |
| margin: {left:"2.5cm", right:"2.5cm", top:"1cm", bottom:"1cm"}, | |
| footer: { | |
| height: "0.9cm" | |
| /* contents: casper.phantom.callback(function(pageNum, numPages) { | |
| return "<div style='text-align:center;'><small>" + pageNum + | |
| " / " + numPages + "</small></div>"; | |
| }) -> throws an error because we don't have access to phantom at this point */ | |
| } // The WebPage instance used by Casper will | |
| }, | |
| zoomFactor: 1.5 | |
| } | |
| }); | |
| var url = casper.cli.get(0); | |
| var output = casper.cli.get(1); | |
| casper.start(); | |
| casper.thenOpen(url, function (status) { | |
| casper.capture(output); | |
| }); | |
| casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment