Copy link to clipboard
Copied
We want to introduce new features with JS to our customers in our bills, offers, etc made in .pdf to leave feedback and use other interactive features.
I m new with both JS and Acrobat Pro too.
For testing purpose for myself and for now I want to acieve to get an alert (message box) immediately after opening my .pdf file.
Any advice how to do it in JavaScript Editor is welcome.
Copy link to clipboard
Copied
Try this:
app.alert("Hello!");
"init" is a sample, you can use every name you like (using the web syntax).
PDF Acrobatic, InDesigner & Photoshoptographer
Copy link to clipboard
Copied
You can use the document open event for this.
Copy link to clipboard
Copied
Thanks for quick answer.
I tried:
function test()
{
document.addEventListener ('open',() => {
alert('Hello');
});
}
in Javascript Editor but didnt work. Doesnt work with load event too.
Copy link to clipboard
Copied
You can't use web browser javascript in Acrobat.
Copy link to clipboard
Copied
Can you please correct below code for Acrobat for the purpose I wrote in my post?
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
//<Document-Level>
//<ACRO_source>test</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:test ***********/
function test()
{
document.addEventListener ('open',() => {
alert ('Hello');
});
}
//</ACRO_script>
//</Document-Level>
Copy link to clipboard
Copied
Try this:
app.alert("Hello!");
"init" is a sample, you can use every name you like (using the web syntax).
PDF Acrobatic, InDesigner & Photoshoptographer
Copy link to clipboard
Copied
Thanks bro!
that does the job.
function test()
{
app.alert("Hello");
}
test();
After the function definition you ve to call it, so it works, but I got the answer.
Thanks again
Copy link to clipboard
Copied
Sorry, comments cannot be edited in this community...
You are right, if you dont define function, of course you dont have to call it. Sorry for confusion

