Last active
May 25, 2017 21:15
-
-
Save charlesBochet/2793c864344feb091ad7c7cc6644fa74 to your computer and use it in GitHub Desktop.
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 = new WebPage(); | |
page.paperSize = { | |
format: "A4", | |
orientation: "portrait", | |
margin: {left: "1cm", right: "1cm", top: "1cm", bottom: "1cm"} | |
}; | |
page.viewportSize = { | |
width: 1920, | |
height: 1024 | |
}; | |
page.zoomFactor = 1; | |
var cookieCreated = { | |
'name' : '$LoopBackSDK$created', /* required property */ | |
'value' : '2017-05-24T13:15:51.787Z', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieId = { | |
'name' : '$LoopBackSDK$id', /* required property */ | |
'value' : 'HR5sb6fEYppjHEGhuinPtW3cJG25FX9iGv9xqKch4qHC0YPKt5rj8HrW2ClcciIt', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieIssuedAt = { | |
'name' : '$LoopBackSDK$issuedAt', /* required property */ | |
'value' : 'null', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieRememberMe = { | |
'name' : '$LoopBackSDK$rememberMe', /* required property */ | |
'value' : 'true', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieTTL = { | |
'name' : '$LoopBackSDK$ttl', /* required property */ | |
'value' : '14400', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieUserId = { | |
'name' : '$LoopBackSDK$userId', /* required property */ | |
'value' : '58ece0e1c0751126bbd2f959', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
var cookieUser = { | |
'name' : '$LoopBackSDK$user', /* required property */ | |
'value' : '{"firstName":"Anthony","lastName":"Stark","realm":"global","username":"ironman@civil.war","email":"ironman@civil.war","emailVerified":false,"id":"58ece0e1c0751126bbd2f959","companyId":"EXE"}', /* required property */ | |
'domain' : 'localhost', | |
'path' : '/', /* required property */ | |
'expires' : 'Session' /* <-- expires in 1 hour */ | |
}; | |
page.addCookie(cookieCreated); | |
page.addCookie(cookieId); | |
page.addCookie(cookieIssuedAt); | |
page.addCookie(cookieTTL); | |
page.addCookie(cookieUser); | |
page.addCookie(cookieUserId); | |
page.addCookie(cookieRememberMe); | |
page.open('http://localhost:8081', function (status) { | |
WaitTenSecsAndPrintPdf(); | |
}); | |
function WaitTenSecsAndPrintPdf() { | |
setTimeout(function () { | |
page.render('output.pdf'); | |
phantom.exit(); | |
}, 10000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment