These ideas are not exclusive: for a print on demand service you typically prepare a PDF. Some people make the PDF itself available for free, some for a small charge, as well as selling the book. There's no capital needed because there's no minimum print run.
For a recent example of book-only, see
http://wozpak.callapple.org/ which is a 350 page cleaned up collation of original Apple 1 and Apple ][ documents for $45, prepared by Bill Martens and Brian Wiser.
For an example of PDF, ebook and print-on-demand, with all the material also freely available on the website, see
http://aosabook.org/en/buy.html which now offers 3 volumes.
I think it's an important principle to let people see what they are buying - either one or two sample chapters or the whole thing. Probably someone somewhere will pirate your book in any case, but if you make a PDF available you'll reach a lot more people and some of them will want to buy a physical copy. (Or an ebook)
Cheers
Ed