Copy link to clipboard
Copied
I have written a Javascript process that searches a template and grabs the text in the title block (by cursor coordinates). The script then uses the text it finds, does a bit of judo and then creates a standardized text string that is then built into a bookmark using the following bit of code:
.....
//Extra function to deal with hyphens
var theTitle = prepareTitle(list)
var root = this.bookmarkRoot;
try {
// If <a> is returning nothing interesting, then call it an odd template
// Highlight it and make sure it gets coded properly
if (typeof a=='undefined'){
root.createChild('***NOT A STANDARD TEMPLATE***', "this.pageNum=" + p, p);
}
else{
root.createChild(theTitle, "this.pageNum=" + p, p);
}
}
catch (e) {
app.alert("Processing error: " + e)
}
....
This process works perfectly, and the bookmarks link to exactly where I intended them to go. The breakdown however, occurs when combining the output with other PDFs. The bookmarks of the other PDFs work properly and appear correct. On this one, the bookmarks are all lost. It seems that if I right click on each individual bookmark and click "Set Destination" the combine is successful. Otherwise, all hope is lost. Is there a way to set these bookmarks (using Javascript) so these bookmarks persist? The right click... etc. is not the best solution when we are working with reports with hundreds of figures.
Thanks for any help!
Copy link to clipboard
Copied
I researched your problem on Github.
There is no tangible and complete workaround to find out the solution to your problem.
I'd drop you a link to find out https://github.com/boazsegev/combine_pdf/issues/44
Copy link to clipboard
Copied
When you say the bookmarks are "lost" do you mean that are gone entirely, or they are still there but don't work, or don't work correctly? My guess is it's happening because of the type of action they have. Using a script you can only create a command to execute a script, while pressing Ctrl+B creates a "Go to page view" action. You can't convert the one to the other in Acrobat automatically, but it can be done using an external tool, like this (paid-for) one I've developed: http://try67.blogspot.com/2011/09/convert-javascript-links-to-real-web.html
Copy link to clipboard
Copied
The individual bookmarks get removed completely and everything collapses down to one bookmark with the name of the PDF. So, while the original script builds out all of the bookmarks, after combining, all "Actions" are lost and only one bookmark remains.