We did it ... about 10 years ago. Interestingly, the available technology has not really changed much.
update is the best answer
Spreadshirt licenses its product: http://blog.spreadshirt.net/uk/2007/11/27/everyones-a-designer-free-designers-for-premium-partners/
Just a license. Do not do this yourself if you do not have real work on graphics and printing. I would say that in today's world you are looking somewhere around 4000-5000 hours of developers time to duplicate what they have done ... And this is if you have two top-level people who work on it.
Short answer: you cannot do this in html.
Slightly long answer :
This does not work partly because you cannot screen the client side and get the level of resolution required for printing a type type. Modern screen resolution is usually about 100 dpi. For a decent print, you really need something 3 to 6 times more than density. Otherwise, you will have a lot of pixelation and it will look like shit when it comes out.
Another answer:
Itβs best to use something like SVG (scalable vector graphics) and provide a drawing surface type as a browser. There are several ways to do this using Flash (Spreadshirt.com uses this) or Silverlight (not recommended). We used flash, and it was very good.
You may be able to avoid using HTML 5. No matter which path you choose, it will be difficult.
Once the user is happy with his design and wants to print it, you create the final file and start the process to convert it to Postscript or in any other format your t-shirt supplier needs. The converter (aka RIP software) is going to either spend a lot of time on development or cost a ton of money ... choose one. (useful hint: buy it. Then we spent about $ 20 thousand. USA, and it was much cheaper than trying to develop).
Of course, this ignores issues such as color matching and calibration. That was our main problem. Each monitor is a little different, and what looks on one computer is red, pink on another.
And for a small background, we made individual wrapping paper. The user added text, selected images from our library or downloaded them and selected a template. Our prints came from HP Inkjet wide format printers (36 "and 60" wide). In the end, we spent from 200 thousand. Dollars. Up to 300 thousand dollars. Only on the resources of the developers to make this happen ... and, unfortunately, the price we had to sell was too high for the market.