Created
July 21, 2015 19:12
-
-
Save marcelaraujo/317798da1aa900a350b6 to your computer and use it in GitHub Desktop.
PhantomJS /dev/stdin -> /dev/stdout
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
var page = require('webpage').create(), | |
system = require('system'), | |
fs = require('fs'); | |
var input = system.stdin.read(); | |
page.viewportSize = { | |
width: 1280, | |
height: 1000 | |
}; | |
page.paperSize = { | |
format: 'A4', | |
margin: '20px' | |
}; | |
page.onLoadFinished = function(status) { | |
page.render('/dev/stdout', {format: 'pdf'}); | |
phantom.exit(0); | |
}; | |
page.setContent(input, 'http://localhost'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment