How do I get bookmark page number?

When two bookmarked PDFs are merged, the bookmarks are merged underneath a bookmark labeled with each file name. I would like to flatten this structure and take out the non-action file name bookmarks because they serve no purpose once merged.

Ultimately, I am renaming these bookmarks, and the empty bookmarks will throw off the counts.

I suppose I could iterate through the bookmarks and throw out any that have children, but there exists the possibility I could have actionable bookmarks with children. Ideally, I would be able to identify what action a bookmark has assigned to it. If none/null, then ignore and handle its children.


Jack Curl


1 Answer

This is tricky. You can't directly know if a bookmark has an action associated with it, and if so, what it is.

A round-about way of finding that out is to execute the bookmark (using the execute method) and then checking if it took you to a different page to what you were previously on. One possible catch is if the bookmarks happens to point to the same page you're on, but that can also be solved with some smart coding.

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


Gilad D (try67)   


Please specify a reason: