This has worked very well for Eloquent JavaScript as well -- I suspect it'd have remained obscure if it hadn't been available online (as a proper, web-friendly HTML page). As it is now, it's being read by a lot of people online, and though I suspect less people read it on paper than online, it is also being recommended and bought enough to financially compensate the time that went into it.