It happens a lot that I face a web page just containing a table of contents linking to the "real pages" (like this or this web page) – and I want to collect all those pages to save them in a single document (i.e. the TOC and the content linked from there). Is there any program for doing this?

If it is not clear yet, this is an example of webpage output I would like to have.

I don’t care much about OS as I have Linux and Windows.

Why I am interested in this? It is much easier to print or read documents in e-reader with this method.

• Calibre is capable of that – available for free and cross-platform (Python). You can collect all pages linked from a TOC together with the TOC, and have them saved in one of many formats – e.g. EPUB/PDF/HTML. Would that fit? – Izzy Feb 12 '16 at 19:51
• tnx 4 edits. I dont care much about OS as I have Linux and windows both.Do I need to add? if no, question is fine as it is. Didnt know Calibre is capable of it.Is there any instruction to do it in Calibre? will make a try. tnx – Woeitg Feb 12 '16 at 19:53
• There's a pretty extensive documentation on the site I've linked to. I use Calibre to produce my eBooks (offline), where I had documents spreading over multiple files and it did fine. Never tried it online myself, but it should work there as well. AFAIR you can limit it to "stay on the site and not go up" – so you don't end up with the entire Internet in one document ;) – Izzy Feb 12 '16 at 19:58
• Does this answer your question? Automatic conversion of sequence of webpages to pdf – tripleee Dec 22 '20 at 14:43

This is how you do it with calibre.

Steps:

Step 1:

Mirror the site that you wish to convert into PDF.

You may use any of the website mirroring software. I have use the IDM website Grabber. This gave me the contents of the complete website.

Step 2:

Once that is done, Open up Calibre and Click on Add books (1).

In the Windows that opens up, point Calibre to the Table Of Contents or the main page that contains all the other pages in the folder.

In this case, we choose the gawk_toc.html (2) and click on the Open Button (3).

Step 3:

Now click on the button on the menu bar.

In the Windows that opens up, select an output format. In our case, PDF. (4)

Click on the PDF output (5) button on the left menu and select an appropriate font size (6) and (7). In this case I had to set this as 8 px to make it look appropriate. You can experiment with different font sizes. But for this document I recommend 8 px.

Click on the OK Button (8). This will start the conversion Process. You will obtain the output after a few seconds. Click on the PDF link to open it.

• great answer, thanks. Can you share the final pdf as an example? – Woeitg May 7 '16 at 16:07
• @Woeitg Sure. Should I attach example images or should I share the entire PDF online? – Aswin P J May 7 '16 at 16:08
• If you can share the entire pdf, it is better – Woeitg May 7 '16 at 16:11
• Download the converted PDF from here drive.google.com/file/d/0B_x1XHnzpYiWV3RHd0tqbU96ZDA/… – Aswin P J May 7 '16 at 16:12
• @Woeitg Calibre You can change the fonts, layouts , margins etc if you wish to using Calibre. Also the hyperlinks within the PDF work. You can click on the table of contents to take you to the section. – Aswin P J May 7 '16 at 16:14

This can be done with Adobe Acrobat that allows copying both the ToC and its links:

Convert a web page to PDF Choose File > Create > PDF from Web Page. Alternatively, choose Tools > Create PDF > Web Page.

Enter the complete path to the web page, or click Browse and locate an HTML file.

To change the number of levels in the website to convert, click Capture Multiple Levels. Enter the number of levels to include, or select Get Entire Site to include all levels from the website.

Note: Some websites have hundreds or even thousands of pages. Converting a large website can make your system slow and unresponsive, and can even use up available hard drive space and memory, causing a system crash. It’s a good idea to begin by downloading one level of pages and then go through them to find particular links to download.

If Get Only N Level(s) is selected, select one or both of the following options: Stay On Same Path

Stay On Same Server

Click Settings/Advanced Settings , change the selected options in the Web Page Conversion Settings dialog box as needed, and click OK.

Click Create.

You do not need to wait for the conversion to complete before adding more requests. While a conversion is in progress, you can convert another page to PDF and that gets added to the queue. The number of requests in the queue are indicated by the Pending Conversions field in the Download Status dialog box.

• Do you know if it can be done in Linux? – Woeitg May 1 '16 at 19:55
• @Woeitg: you said you could use Windows and Linux but you're asking for Linux now? – Thomas Weller May 1 '16 at 20:12

This can be done online: http://www.verypdf.com/online/site-to-pdf-converter.php

This page converts a webpage with links into a pdf. It has a free trial - but subscription, if you want to keep it.

HTTrack Website Copier is an open source website archiving utility that can download an entire website in the form of an offline archive on your local drive. It recursively builds all directories of the website (and/or mirror websites) and fetches its content, which can also be updated later on. HTTrack can therefore be quite handy for saving exact copies of entire websites and their mirror sites on a local folder. This can also help web masters avoid using a FTP connection for downloading copies of a website, as they can quickly do so with the help of this tool. Furthermore, it’s a cross platform application and is available for both Windows and Linux.

Archiving a website with HTTrack is easy. In the first step, enter a project name, category and specify a destination folder. The default directory for saving files is C:\My Web Sites. Click Next to proceed.

WinHTTrack Website Copier