Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found

Sometimes on your node.js project you have seen problems like “Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found” by some npm modules. Error: /lib64/libc.so.6: version ‘GLIBC_2.14’ not found This error comes when the available version of glibc is not compatible by the node module. So, if you still want to work with that module, you need to […]

PhantomJs: Convert a String to an Image/PDF.

To convert a string or HTML to PNG or PDF using phantomjs: Create a File say texttoimage.js Add this code: var page = require(‘webpage’).create(); page.viewportSize = { width: 200, height : 200 }; page.content =  “This Text will be converted to Image”; page.setContent(page.content,page); window.setTimeout(function () { page.render(‘newimage.png’); phantom.exit(); }, 1000); Save and Run the Script […]

JavaScript – Executing Multiple window.onload events on a webpage

For executing multiple window.onload add this script to the head head section: <script language=”javascript” > function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != ‘function’) { window.onload = func } else { window.onload = function() { if (oldonload) { oldonload() } func() } } } </script> Add Function to window.onload event use : […]