title_body: How to convert a html ebook to a pdf file? Is there some program which can convert a html ebook (consisting of many html files located under different directories and linked to each other) to a pdf file?
  For example, some shell scripting (e.g. in bash) which calls some program that does the conversion? 
  
  Additionally, if possible, can the resulting pdf file  have outlines/bookmarks for clicking and jumping, according to the structures of the html book?
  
  An example of a html ebook can be downloaded from http://en.cppreference.com/w/Cppreference:Archives. Extract it, and there are several levels of subdirectories. At the root level, there is a file cppreference-doxygen-local.tag.xml which seems to list all the html files, and might be helpful for convertion to a pdf file.
  
  Thanks.
upvoted_answer: Let me tell you the easiest way: you could paste the entire contents from the browser into a MS word/Libre Office file and then export to PDF. Both programs are fairly good at importing HTML -- they are just lousy at exporting to HTML. If you made sure that all H1 titles were mapped to a single style in the office program, you could either generate a TOC at the top or permit an outline view inside the PDF. It's unlikely that any of the original HTML links will work though. 
  
  There are other ways to do it -- using GUI tools like Calibre or Sigil. You could also try the open source WKHTMLTOPDF  (which I haven't tried yet). 
  
  UPDATE: I just looked at the content you are trying to store. This is structured technical reference material; probably not a good candidate for the cut and paste solution I recommended and not good viewing for PDF. You probably need to store the html files on your device so that an app like Android's Offline Browser can view it. I just tried viewing your web URL in Offline browser, and it probably is what you're looking for. It stores in offline mode on your android device the site, with lots of ways to configure it (depth of links, number of links, etc).