Я пытаюсь создать собственные нижние колонтитулы, например, в примерах phantomjs: https://github.com/ariya/phantomjs/blob/master/examples/printheaderfooter.js
Вот мой код:
var phantom = require('node-phantom');
phantom.create(function (err, ph) {
ph.createPage(function (err, page) {
page.set('paperSize', {
format: 'A4',
orientation: 'portrait',
footer: {
contents: ph.callback(function (pageNum, numPages) {
if (pageNum == 1) {
return "";
}
return "<h1>Header <span style='float:right'>" + pageNum + " / " + numPages + "</span></h1>";
})
}
}, function () {
page.open('http://www.google.com', function () {
})
})
})
});
Но, к сожалению, я получаю следующую ошибку:
TypeError: Object #<Object> has no method 'callback';
Это ошибка, что ph не предоставляет метод обратного вызова?