initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
var page = require('webpage').create(),
|
||||
system = require('system');
|
||||
|
||||
data = system.args[1];
|
||||
console.log(data);
|
||||
data = JSON.parse((data));
|
||||
|
||||
page.viewportSize = { width: 600, height: 600 };
|
||||
|
||||
page.paperSize = {
|
||||
format:data.pagesize,
|
||||
orientation: data.orientation,
|
||||
margin: {left:data.margins[0], right:data.margins[1], top:data.margins[2], bottom:data.margins[3]},
|
||||
header:{
|
||||
height:data.margins[2],
|
||||
contents:phantom.callback(function(){
|
||||
return data.header;
|
||||
// return '<div id="pdf-header"><h4 style="font-family:Helvetica, Arial; color:#b2b2b2">PARTITUUR FRAMEWORK PLUS</h4><br /><hr style="border:0;height:1px;background-color:#b2b2b2;margin:0;" /></div>';
|
||||
})
|
||||
},
|
||||
footer: {
|
||||
height:data.margins[3],
|
||||
contents: phantom.callback(function(pageNum, numPages) {
|
||||
var TODAY = new Date();
|
||||
var today = TODAY.getDate() + '-' + (TODAY.getMonth() + 1) + '-' + TODAY.getFullYear();
|
||||
return '<div style="color:#b2b2b2;font-family: Helvetica, Arial; font-size:10px;"><hr /><div style="float:left; padding-left:4px">pagina: ' + pageNum + ' van ' + numPages + '</div><div style="float:right; padding-right: 5px">afdrukdatum: ' + today + ' </div></div>';
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
page.zoomFactor =1;
|
||||
console.log(data.url);
|
||||
page.open(data.url, function (status) {
|
||||
if (status !== 'success') {
|
||||
console.log(status);
|
||||
console.log('Unable to load the address!');
|
||||
phantom.exit();
|
||||
} else {
|
||||
window.setTimeout(function () {
|
||||
page.render(data.filename);
|
||||
phantom.exit();
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user