"use strict"; var page = require('webpage').create(), system = require('system'); function someCallback(pageNum, numPages) { return "
asdfadsfycvx
*/ if (page.evaluate(function(){return typeof PhantomJSPrinting == "object";})) { paperSize = page.paperSize; paperSize.header.height = page.evaluate(function() { return PhantomJSPrinting.header.height; }); paperSize.header.contents = phantom.callback(function(pageNum, numPages) { return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.header.contents(pageNum, numPages);}, pageNum, numPages); }); paperSize.footer.height = page.evaluate(function() { return PhantomJSPrinting.footer.height; }); paperSize.footer.contents = phantom.callback(function(pageNum, numPages) { return page.evaluate(function(pageNum, numPages){return PhantomJSPrinting.footer.contents(pageNum, numPages);}, pageNum, numPages); }); page.paperSize = paperSize; console.log(page.paperSize.header.height); console.log(page.paperSize.footer.height); } window.setTimeout(function () { page.render(output); phantom.exit(); }, 200); } }); }