PhantomJS - zoomFactor Property



This property specifies the zoom factor for render and renderBase64 methods. It helps to zoom a page and take a screen capture if required. Value higher than 1 will increase the size of the page and less than 1 decreases.

Syntax

Its syntax is as follows −

var wpage = require('webpage').create(); 
wpage.zoomFactor; 

Example

The following example shows the use of zoomFactor property.

var wpage = require('webpage').create(); 
wpage.zoomFactor = 0.3;  
wpage.open("http://www.google.com", function (status) {  
   window.setTimeout(function () { 
      wpage.render('output.png'); 
      phantom.exit(); 
   }, 200);  
});

The above program generates the following output.

ZoomFactor Search
phantomjs_webpage_module_properties.htm
Advertisements