am implementing PDF "Bookmark" feature. I am working at a startup where we generate reports in PDF and I really need this feature.
I read the contributing guideline. And I created the a new Discussion Thread on Google Groups: https://groups.google.com/forum/#!topic/phantomjs/EV2IwIuhjtk .
But I find it a bit less active. Also, I need to implement this feature over this weekend. Since this looks "must-have" features, I thought I will go-ahead and create an Issue here directly. So let me cross post the content here
Here is what I researched so far:
AFAICT, many people wanted this feature since June 2013 (nearly 4 years as of writing this). Here are some of the Issues that I could come across on GitHub. Most of them are still open:
And maybe many more, but I am not sure. And there are still few unanswered questions on StackOverflow and Quora regarding this same issue. So it is clear that this is a feature that needs to be there.
I have done my home work:
If I am not wrong, I think the logic to add bookmarks will go here: https://github.com/ariya/phantomjs/blob/6abff248109fe2b6c0e7581e06dcf3c52b64a15d/src/webpage.cpp#L1291
And that I should use: https://github.com/qt-labs/qtpdf/blob/dev/src/pdf/qpdfbookmarkmodel.cpp to create bookmarks.
This is how I thought I should approach the problem:
I will add a bookmark
object to the webpage
object. And when we renderPdf(), I will look at this attribute to determine wether we should create a bookmark or not. Booksmarks will be created only if this attribute is set - that way, we do catch the people who are already using it by surprise (It will be disabled by default). First, I will parse through the page to find all heading tag and nest it, if need be. Then find "Fragment Identifiers" in a HTML and convert it into a Bookmark (nesting it under respective heading bookmarks).
This is related to the following Issues: #11442, #13959, #14019, #14673
CC: @ylf2345, @gladson, @anko, @dwarburt, @neilsustc, @hammond13, @caleblloyd, @ckreon, @jasonswearingen, @astefanutti, @wazico, @Nikolay-Kha, @MirrorC, @v-anyukov, @mwittmann, @AttitudeMonger, @sambasivaraomangapati
Any pointers/suggestions/inputs are greatly appreciated.
This sounds great, and I hope we're able to get it working! Thank you for gathering all the pieces and putting a plan together.
Guys, Apologies Guys. I tried working on this since the last 2 days. But I was not able to figure out. Whatever little work I was able to do is in this commit: https://github.com/ds-forks/phantomjs/commit/369501a279fb3d84bf839a844e5bd9c878d17473 - leaving this here for people who might want to solve this problem in the future. Or if you have any pointers, I can take a crack at this again. Leaving this Issue open, unless the maintainers want to close this.
it's a tough issue, props to you for giving it a try :)
Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
Most helpful comment
Guys, Apologies Guys. I tried working on this since the last 2 days. But I was not able to figure out. Whatever little work I was able to do is in this commit: https://github.com/ds-forks/phantomjs/commit/369501a279fb3d84bf839a844e5bd9c878d17473 - leaving this here for people who might want to solve this problem in the future. Or if you have any pointers, I can take a crack at this again. Leaving this Issue open, unless the maintainers want to close this.