I am working on a nodejs server that displays html in pdf, png or jpg. ( https://github.com/svenhornberg/pagetox (server.js) if you want to try)
It works very well, displays complex sites, but only by the time I want to upload a simple image. For example, I send the following code to my server:
<!doctype html> <html> <head> <title>logo</title> </head> <body> <img alt="logo" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Wikipedia_Logo_1.0.png"> </body> </html>
The code should be in order. But the displayed response image does not contain the logo image. As stated in the phantomjs documentation ( http://phantomjs.org/api/webpage/property/settings.html ) localToRemoteUrlAccessEnabled is set to false, so set it to true as specified in the phantom documentation - node ( https: // github .com / sgentle / phantomjs-node / ):
page.set('settings.localToRemoteUrlAccessEnabled', true); page.set('settings.loadImages', true);
to prove that it is set to true, I called getter, which returns true
page.get('settings.localToRemoteUrlAccessEnabled', function(data) { console.log(data);});
I am using node v0.10.26 with phantomjs- node (0.6.1), phantomjs (1.9.7) on linux
Now the question is, does anyone see the error? Or can give me a clue what I'm doing wrong. Or any other features where phantomjs / phtanom-node does not load external images
I use the render method to create a png, jpg or pdf file. I call the method inside the evaluation function as a callback, so the site must be fully loaded. (full code is at https://github.com/svenhornberg/pagetox/blob/master/server.js )
Edit1: I am not behind a proxy server that may block requests.