PDF Bookmarks/Outlines/Table of Content Support
seanmrnda opened this issue · 4 comments
You mean the pdf bookmarks/outlines? No, and I had also explained this in the README common Issues part 3.
- Can you add the bookmark to the PDF reflecting the Table of Contents, just like what wkhtmltopdf supported?
This should be realized by Chromium, and an issue has already been filed for this here.
Hi! Finally support for the bookmark/outline of the PDF file is available now(mdbook-pdf-outline). It is written in Python and is another backend for mdbook
and should be used with mdbook-pdf
and the mdbook version mentioned in Common Issues 2 for fixing the broken links in print.html
.
You can install this backend by pip install mdbook-pdf-outline
.
Remember to put the following to the end of your book.toml
, after [output.pdf]:
[output.pdf-outline]
If you want to use the table of content just like the one shown in the print.html
page for PDF file, you can leave the book.toml
as it is.
If you prefer to use the table of content just like the one generated by wkhtmltopdf
(generate entries based on the headings), you can turn on the like-wkhtmltopdf
option by using the following to your book.toml
:
[output.pdf-outline]
like-wkhtmltopdf = true
You can find the outlined version at book/pdf-outline/output.pdf
.
Todos:
It would be great if we can rewrite mdbook-pdf-outline
into rust, but I can hardly find a proper pdf library in rust that supports named destinations, lopdf is a promising one, let's wait for it to release the new feature.
Samples of PDFs with table of content: https://github.com/HollowMan6/mdbook-pdf/actions/runs/3789636358