percollate
percollate copied to clipboard
PDF: Add a Table of Contents to the metadata
A PDF generated from many web pages would benefit from a Table of Contents, implemented as PDF bookmarks. We'll probably need to post-process the PDF with something like HummusJS to write the TOC. (Also, I'd appreciate if someone with more experience would explain whether its license is compatible with our MIT License)
Related: #25
Thanks @danburzo for all of your hard work on this project.
I wanted to share that this library looks really promising for our use case of a CI publication pipeline that generates PDFs. We have explored leveraging html/css and converting to PDF and it gets us 80% of the way there. Other features such as page-sandboxed footnotes are also very hard to come by.
Our current biggest obstacle is just what you stated here, we are unable to generate a ToC. The libraries that do handle ToC are proprietary and typically not compatible to be distributed with our open source software.
We will be watching this project and even willing to contribute when opportunity arises. Thanks again!
We may be able to have some luck with Apache PDFBox, but it's written in Java and I'm not sure yet if/how we'll be able to use it.
I've implemented a basic TOC functionnality: https://github.com/danburzo/percollate/pull/81
Not sure that's what you had in mind, but for my use case it's gonna be usefull, hope it helps.
Hi @guybedo, thank you for the contribution! This issue specifically refers to a PDF functionality to show an Outline in the PDF structure itself rather than a separate page in the PDF. But your addition is very welcome as well :-)
@danburzo did you get this working? Looking to do something similar with hummusJS
@larryboymi — unfortunately, no. I'm currently caught in dayjob work, and did not have a chance to explore this further. Any sort of insight / contribution on this subject is greatly appreciated!
Thanks for responding... I think I'll try to create an example with hummus and then share with you... Was just hoping to shortcut lol
I created an npm module with this functionality. Check it out and give feedback, thanks! I'll try to add some examples of how to do it in your regular flow, but the base index.js
file shows the usage.
Chrome 85 / puppeteer 5.2.1 you can produce tagged PDFs, and it seems an outline based on that is in the works