Code to print bill in thermal printer

Does anyone know how to print a table like structure and logo , like a bill or receipt in thermal printers.??? If so please share the code , so that i could follow it. I am stuck in this section

anyone ???