In phantomjs, page.evaluate is a page context and you can not call a function defined outside of it. You should pass your function as second argument to the page.evaluate like this:
function fGetXpathAd(fPrintObj) {
xPathAd = "//div[@class='col-xs-12 col-sm-12 col-md-12 col-lg-12 home-solutions-head']";
console.log(xPathAd);
var adcopy = document.evaluate( xPathAd, document, null, XPathResult.STRING_TYPE, null);
fPrintObj(adcopy); //WILL WORK
return adcopy;
}
function main(status) {
console.log('Evaluating ad-copy.... ');
var a = page.evaluate(fGetXpathAd, fPrintObj);
// fPrintObj(a); // WORKS
phantom.exit();
}
I hope this will help.