Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/webshot.phantom.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,29 @@ var toOverwrite = optUtils.mergeObjects(

optUtils.phantomPage.forEach(function(key) {
if (toOverwrite[key]) page[key] = toOverwrite[key];
if (key === "paperSize" && page[key] && page[key].header && page[key].header.contents) {
var header = {
"height": page[key].header.height,
"contents": phantom.callback(function() { return options.paperSize.header.contents; })
};
page.paperSize.header = header;
}
if (key === "paperSize" && page[key] && page[key].footer && page[key].footer.contents) {
var footer = {
"height": page[key].footer.height,
"contents": phantom.callback(function() { return options.paperSize.footer.contents; })
};
page[key].footer = footer;
}
if (key === "paperSize") {
page.paperSize = {
"format": options.paperSize.format,
"orientation": options.paperSize.orientation,
"margin": options.paperSize.margin,
"header": header,
"footer": footer
};
}
});

// The function that actually performs the screen rendering
Expand Down