phantomjs from string to render image

44 views
Skip to first unread message

asci.e...@gmail.com

unread,
Nov 1, 2016, 4:18:23 PM11/1/16
to phantomjs

I don't understand where I mistake, I would create a HTML page from string then I would to create a png image, my try:


var page = require('webpage').create();


page.open('about:blank',function(s){

page.content =  "This Text will be converted to Image";

page.setContent(page.content,page);

});

page.onLoadFinished = function(){

page.viewportSize = { width: 300, height : 200 };

page.render('example.png');

console.log('render: ' + page.content)

phantom.exit();

};

 

I always obtain an empty image... 
thanks

asci.e...@gmail.com

unread,
Nov 3, 2016, 3:46:24 AM11/3/16
to phantomjs
I resolved:



the Centos 7 didn't have the fonts.
I hope help somebody.
Reply all
Reply to author
Forward
0 new messages