简体   繁体   中英

Convert javascript links in PDF to real annotations

We are using javascript in PDFs to facilitate the automated creation of Goto page.. etc links, or based on certain keywords.

LIke this: this.pageNum = 2

This works fine, as long the PDF is opened inside a viewer that supports javascript.

I am now looking for a way, preferably i Java, to convert these annotations to real annotations, which will then be usable outside of Acrobat.

I have done quite some research on the net so far (i think. ,) - but couldnt find an approach how to go on with that.

First and foremost, links containing JavaScript are real annotations.

Whether it is possible to convert depends a lot on the JavaScripts you attempt to convert. With very simple things like pageNum = x you may be able to find a replacement, but you will quickly run out of options, because the number of Actions available is rather limited.

But already a simple construct like setting the value of a document level variable (set in a document-level script):

var cameFrom ;

in the link or button you use to jump to another page

camefrom = this.pageNum ;

and have a button/link to jump back to where you came from

this.pageNum = camefrom ;

will be essentially impossible to solve programmatically.

You will also have to make many assumptions, which may work for your specific files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM