Disclaimer: This doesn’t always work on all printers. It is best if your printer has a facility to feed paper straight through rather than curling back on itself. Note that some inks will just wash off, so trial first.
The fabric has to be 100% cotton and the printer has to be an inkjet printer (i.e. not a laser) and you also need some freezer paper.
Cut the fabric and the freezer paper into an A4 size.
Iron the fabric onto the freezer paper. This creates a paper/fabric sandwich. (Note: The freezer paper can be used several times, write on it how many times it has been used)
Fold over a piece of sellotape all along the leading edge of the top of the paper/fabric sandwich. This should stop the leading edge from catching in the printer and is removed after printing. Sometimes it is necessary to put a strip along each side of the paper/fabric sandwich as well.
Place in printer and print. Try to use a quick print so the paper is not going backwards and forwards a lot.
Let dry, remove paper from back, iron with a very hot iron, and let dry for 24 hours.
Then rinse, (a bit of ink will come off), allow to dry and iron again.