Anki Manual as PDF doesn't have a Table of Contents

The Anki Manual is great. You can even print it as a PDF from the print icon in the corner. Which is useful to have on a tablet.

However, when doing this, the PDF file doesn’t have a table of contents at all. Whether in a page, or the PDF metadata itself. So the PDF version of the manual is half as useful. You can read it one page at a time, but it’s difficult to navigate. Adding the table of contents as one of the pages would solve this problem.

Could you please add the table of contents to the Anki Manual, for when printing as a PDF?

2 Likes

With respect, here are two advantages of the online manual.

Advantage #1: Open multiple pages simultaneously

I never use left-click in a browser - only right-click. So, right-clicking on any link in the Anki manual allows me to have several interrelated pages open simultaneously for a single task. I can jump back and forward from one page to the other.

Advantage #2: blindingly fast search

The online search presents 30 hits. The search is so fast that the results appear before I actually type anything. Partial searches are supported. For example: “man fil” finds “managing files”, “filtered manually”, and so on. The PDF search takes hours to jump from one candidate to another. Exact spelling is essential.

Thanks

1 Like

Okay. But, if you prefer to use the PDF version, you still don’t have a table of contents.

I’m just suggesting to also add the TOC in the text so people who use the PDF also have it as well?

The print functionality is provided by mdBook, which in turn relies on the native browser print functionality. Unfortunately, printing has more limitations like relative links in pages pointing to the original web links of the manual, so if you click on some relative link in a page, it will open a web page to the online version instead of scrolling to the target section in the PDF.

2 Likes

I’m just suggesting to add the table of contents in the text itself. Right now, the PDF version doesn’t have a TOC at all.

Many pages actually have TOCs for sections that appear in the PDF, but there is no main TOC listing all pages like in the sidebar of the online manual.

So there is no TOC…
(Contents of a section is not a TOC.)

1 Like

I mean things like this, which is a table of contents obviously:

From what I can tell, browser print to pdf doesn’t support adding Table of Contents. Nor does it support href="#id" style internal links.

So as u/abdo pointed out, adding a table of contents is not as simple a job as it sounds like. You’d basically have to completely rewrite the code that generates pdf files.

It would be good to have, but unlikely to be added.

(On that note, it doesn’t look like mdBook will be adding the feature any time soon either. The issue’s been open for 6 years.)

2 Likes

If it’s not possible, why are there parts of the TOC throughout the PDF manual (like in the screenshot three posts above)?

I’m not saying they should be hyperlinks. Just saying it would be good to have a full TOC for the PDF manual—since right now there is none, and it makes it difficult to use the Anki manual as a PDF.

It’s because these parts are statically generated and part of the online version, while a TOC listing the pages doesn’t exist there (there is a sidebar instead), so the simple browser print function doesn’t work here since it just converts the HTML to PDF without the ability of much customization. A solution for this would be to bypass the browser print function and instead implement a custom one.

2 Likes

No need to bypass anything. Just add the TOC to the online version (as text, like the TOC sections throughout), so that the TOC is statically generated and part of the PDF version.