toImage could be applied by node.js

toImage could be applied by node.js, but node.js doesn't have document.