From 0006cd76e38c19caa5099d387334372f2ab4792f Mon Sep 17 00:00:00 2001 From: Nicolas Turlais Date: Tue, 13 Jun 2017 17:44:59 +0200 Subject: [PATCH 1/2] Added page.viewportSize --- lib/phantom-page-render.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/phantom-page-render.js b/lib/phantom-page-render.js index 8de023c..d2bd2c1 100644 --- a/lib/phantom-page-render.js +++ b/lib/phantom-page-render.js @@ -38,6 +38,10 @@ if (options.phantomPageSettings) { page.settings = defaultsDeep(options.phantomPageSettings, page.settings) } +if (options.phantomPageViewportSize) { + page.viewportSize = options.phantomPageViewportSize +} + page.open(url, function (status) { if (status !== 'success') { throw new Error('FAIL to load: ' + url) From 2e7cd6dca09ed8fc54fabd2143c155a40661c4ad Mon Sep 17 00:00:00 2001 From: Nicolas Turlais Date: Tue, 13 Jun 2017 17:47:52 +0200 Subject: [PATCH 2/2] Added viewportSize to exemple --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bb3e7c..cecfed9 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,13 @@ module.exports = { phantomPageSettings: { loadImages: true }, - + + // http://phantomjs.org/api/webpage/property/viewport-size.html + phantomPageViewportSize: { + width: 1280, + height: 800 + }, + // Manually transform the HTML for each page after prerendering, // for example to set the page title and metadata in edge cases // where you cannot handle this via your routing solution.