Well to answer your question, let me explain you how this works.
To print a file via bluetooth you need have corresponding profiles in the phone like
- BPP - Basic Printing Profile
- HCRP - Hardcopy Replacement Profile
- BIP - Basic Imaging Profile etc.
If the phones have this profiles built into the bluetooth stack, then you can develop a top layer application using bluetooth api's and use these features.
For Wifi priting, there are lot of cloud print apps in Google play store which you could use.
To achieve wifi printing, you can setup a server and do a cloud push to the server and server pushes the file to the printer. There are lot of material available online to do this.,