JavaScript Page.render() returns false

I'm using phantomjs for taking screenshots of several webpages. To get a screenshot image i have used the following code.

var page = require('webpage').create(); 
page.viewportSize = { width: 1200,height: 800};
page.open('http://<randomwebpageAddress>', function(status) {
  console.log(status);
  console.log(page.render('screenshot.png'));
  phantom.exit();
});

but the result for some page is

status = "success" but page.render returns false

my question is:

when does page.render() return false?

Answer:1

Although the documentation says that there is no return type for render(), it always returns a boolean denoting the success of the rendering operation.

The function will always return false if the content is empty, which should never happen.

Since the render() function is capable of rendering into multiple formats such as PNG, JPG, GIF, PDF, the return value may have slightly different meanings.

PDF

false can only be returned, if the format options where set incorrectly.

GIF (pre v2)

It only returns false when the destination file is not writable.

JPG, PNG (and GIF)

The return value comes from QImage::save() and denotes a successful rendering and file write.

Answer:2

I am trying to load webviews in a view pager. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = null; ...

I am trying to load webviews in a view pager. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = null; ...

I have a form that accepts name, phone no. Currently, I have done validation for non empty fields. I want to add validation for name (alphabets) and phone no.(numbers). My current code is given ...

I have a form that accepts name, phone no. Currently, I have done validation for non empty fields. I want to add validation for name (alphabets) and phone no.(numbers). My current code is given ...

  1. javascript check empty number

I have the following JS code: var b=0; function Fetch_Comments() { var comment=document.getElementsByClassName("comnt_list"); for (i=0; i<comment.length; i++) { var ...

I have the following JS code: var b=0; function Fetch_Comments() { var comment=document.getElementsByClassName("comnt_list"); for (i=0; i<comment.length; i++) { var ...

The reply at MVC3 Pass Model view to controller using javascript implies that this was impossible, at least for MVC 3. I was wondering if there is any way in MVC 4 to quickly pass the entire form ...

The reply at MVC3 Pass Model view to controller using javascript implies that this was impossible, at least for MVC 3. I was wondering if there is any way in MVC 4 to quickly pass the entire form ...