Hello PO-1,
Welcome to the HP Support forums. I understand that you would like to learn how to connect your Deskjet 2540 printer to use Google Cloud Print.
As the Deskjet 2540 is not an ePrint enabled printer you would need to set up your printer as a Classic printer in Google’s Cloud Print. I’ve included the Using Google Cloud Print with your HP Printer document to walk you through how to set it up. For additional reference I’ve also included Google’s Connect Your Classic Printers with Google Cloud Print. And in case you weren’t sure how to print with Google Cloud Print, I’ve also included Google Cloud Print’s “Print a Page”.