1

How can I convert a html book (consisting of a number of html files linked to each other) to a pdf file on Ubuntu?

Hope the resulting pdf file can have bookmarks according to the structures of the html book.

The html book can be downloaded from here. Extract it, and go to help, and the directory manual is the html book.

  • Have you taken a look at pandoc? It manages to convert between tons and tons of things (including PDF and HTML). – HalosGhost Jun 24 '15 at 3:45
  • thanks. how shall I use pandoc to convert? – Tim Jun 24 '15 at 3:46
  • Their documentation should take care of that :) – HalosGhost Jun 24 '15 at 4:07
  • thanks. in the extracted directory from the zip file, the html book is in the directory help/manual. Its first page is index.html, which contains links to a lot of other htmls in directory help/manual/man. Do I have to specify all the html files as inputs to pandoc, or just index.html and no other html files as input to pandoc? If the former, how do you specify the many html files in the correct order? – Tim Jun 24 '15 at 4:15
  • That is a good question of which I know not the answer. Though I know of pandoc, I have never personally had a need to use it. – HalosGhost Jun 24 '15 at 4:20
1

First off, not sure I can get the bookmarks and such made automatically, as nice as that would be.

You can manually add them, though, afterwards.

Try opening the HTML file in firefox, and going to file -> print (ctrl+p). Then, click "Print to File" and click 'PDF'. Then type your file name and select the folder to save it in.

enter image description here

If you want to automate it, maybe you want wkhtmltopdf? To install it (in ubuntu or debian or linuxmint or similar), type:
sudo apt-get install wkhtmltopdf

1

You can use package htmldoc, which is much easier to get working than pandoc. It takes a list of html files and resolves the hyperlinks between them to produce a single pdf with working links, and includes the images.

htmldoc $(find help/manual -name '*html' | sort) --outfile  /tmp/out.pdf

Of course, it would help to know in what order to collate the html files. I just sorted them on name.

Unfortunately, on my fedora 20 I got core dumps when I tried to put more than half the audacity files through at the same time. I got to 440 pages of output though. Perhaps just not enough memory. YMMV.

Remember for safety to prefer the real audacity web site or your OS package manager rather than sourceforge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.