forked from ggrossetie/asciidoctor-web-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ideally this would be handled by Chrome during printing. However, https://bugs.chromium.org/p/chromium/issues/detail?id=840455 is not implemented yet (and cannot rely on metadata extracted from the asciidoc format directly). Therefore this implements it by introducing some kind of post-processing using `pdf-lib`. If the `:toc:` property is set, the `.adoc` file is scanned for sections (respecting the `:toclevels:` attribute) and an outline is generated. This only works if a ToC is also generated within the document (or better: links exist to each section), because otherwise Chrome would not generate the necessary `Dests` fields within the PDF. Unfortunately, Chrome also has some bugs regarding Umlaute in anchors, leading to omission of the relevant `Dests` fields. Therefore a warning is printed if a anchor cannot be located in the `Dests` field of the PDF catalog. Based upon https://gitlab.pagedmedia.org/tools/pagedjs-cli/commit/df0d10bd1bb12d1e2077323e1fb5eec75da35a1e which itself is based on @Dopding's comment at: Hopding/pdf-lib#127 (comment)
- Loading branch information
Erik Schilling
committed
Oct 25, 2019
1 parent
1e0de98
commit 05414d6
Showing
3 changed files
with
161 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters