PhantomJS not exactly rendering HTML to PNG

Posted by John Leonard on Stack Overflow See other posts from Stack Overflow or by John Leonard
Published on 2013-10-19T16:44:58Z Indexed on 2013/10/19 21:56 UTC
Read the original article Hit count: 550

Filed under:
|
|

I'm having trouble adjusting PhantomJS to create a PNG file that matches the original browser presentation.

Here is the entire sample html file. It's a sankey diagram creating using rCharts and d3-sankey. (You'll need to save the file to your hard drive and view it from there.)

I'm running on Windows and using rasterize.js:

>> phantomjs.exe rasterize.js test.html test.png

ISSUE: Below is a snip of one of the text strings when viewed in a browser:

enter image description here

And here is a snip of the same string from the PNG created by PhantomJS:

enter image description here

How do I make the text-shadow go away? I've played around with various CSS attributes (text-shadow) and webkit-specific attributes (e.g., -webkit-text-rendering), but can't seem to make it go away.

Is this a setting in PhantomJS? in the underlying webkit? or somewhere else?

Many thanks!

© Stack Overflow or respective owner

Related posts about webkit

Related posts about font-face