Is it possible to add javascript to images in pdf?

I know that the vast majority of reasons for using pdf files on a website include allowing users to print documents, but one of our customers asked me to create a PDF file for online viewing, which will have interactive images that open a lightbox overlay style that displays a large version of the specified image.

Is it possible? I found the Adobe devnet site for Acrobat and javascript, but there is a lot of information. I'm not looking for someone to get me the code (although other articles and manuals are certainly welcome), but I don't want to spend a lot of time looking at the Adobe documentation, if someone can just tell me right now, it's not even possible.

+4
source share
1 answer

I can’t answer specifically how you will do it, but I thought it would be interesting (with some painful curiosity) to check the Adobe PDF Specification to see if the specification itself supports it.

In Version 1.7, Section 8.5.3 Action Types (PDF) , it mentions Rich Media commands, as well as the ability to execute arbitrary ActionScript or Javascript. So, because of its sounds - yes, you could do it, assuming you can change the contents of the document (or show / hide elements) at runtime.

However, it is probably worth noting that many people do not use or cannot use Adobe Acrobat to read PDF files, so using additional features such as this can have unwanted side effects and can make the document unreadable.

+2
source

Source: https://habr.com/ru/post/1396741/


All Articles