Open books (like Read Ruby organized by runpaint) are great,
but if there is no pdf version, how to read/print it properly !?
Converting to pdf…
require 'rubygems' require 'open-uri' require 'hpricot' url = 'http://ruby.runpaint.org' links = Hpricot(open(url).read).search('a').map{|link| link['href'] } links.reject!{|link| link.include?('#') or link.include?('//') or link.include?('@') } links -= ['/opensearch', '/toc'] links.unshift('/toc') links.map!{|link| url+link } content = links.map{|link| open(link).read } html = "#{content * "/n/n/n/n"}" out = 'temp.html' File.open(out,'w'){|f| f.print html } `wkhtmltopdf #{out} temp.pdf`
(or download the version from 2010-09-21)
Have fun!