Copy link to clipboard
Copied
Hello everyone,
need to set a variable value in a PDF from Javascript.
How can i set a variabile in a PDF, using Javascript or Java?
There's away to do this?
Kind regards
Copy link to clipboard
Copied
Acrobat uses Javascript. You set the value of a variable like this:
var a = 1;
Copy link to clipboard
Copied
It might be that you mean something different by variable than we do. Please explain your needs in more detail. Acrobat supports JavaScript, and not Java.
Copy link to clipboard
Copied
Thank you all for the reply.
I know that Acrobat uses Javascript.
I would like to know if there's a way to access the internal Javascript of the document and set a global variable (ex. a boolean) to true or false. This from a web page that have is own javascript that load or open the PDF or from a Java classes that, again, load or open the PDF. This is needed to make the PDF "aware" that it is working in a certain context and, by conseguence, the internal PDF Javascript will behave differently.
Maybe this not is the best route to follow, but i'm open to suggestions 🙂
More generally, i do i communicate from the client side Javascript (the scrips that are in a web page) or from a Java class with the internal code of the PDF?
I hope i have explained better my needs.
Thank you all
Copy link to clipboard
Copied
What web browser does you use?
Copy link to clipboard
Copied
Since each browser has its own PDF viewer, with its own form functions (often not working right) and perhaps nonexistent JavaScript, the whole idea of using PDF forms in a browser is very dubious indeed. PDF has been killed by its own success, because browser Acrobat form/JavaScript support wasn't something done properly by the browser makers. I suggest abandoning PDF in your solution completely, or doing server-side manipulation instead.
Copy link to clipboard
Copied
Read This:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
Copy link to clipboard
Copied
Thank you all for the reply. I've got precious informations.