Copy link to clipboard
Copied
I'm almost done creating a unique PDF but in order to use it properly, I wanted to include some instructions to the viewer so they know how to access all of the inner workings of the document.
I created a comment text-box and filled it with all of the relative information. How can I ensure this comment is viewable upon opening the document and then the view can either hit an "okay" box or a "close" box in order to view the document proper?
Copy link to clipboard
Copied
Like this, more or less:
var myDialog = {
// dialog definitions go here
}
app.execDialog(myDialog);
Copy link to clipboard
Copied
Using a comment is not really a good way of doing that. Instead, you can use a script that displays a modal alert window.
The code would be something like this:
app.alert("Enter your message to the user here.",3);
And you should place it under Tools - JavaScript - Document JavaScripts. Create a new item (call it "scripts", or something like that) and then paste the code into it. It will execute each time the file is opened.
Copy link to clipboard
Copied
Thanks for the quick reply Try67!
I tried using the JavaScript window and I was a little dissuaded that the title stated "Warning" on the popup. I was hoping to change that to read "PDF instructions" but I wasn't sure where to do that exactly.
That and the fact that I'm not sure how to code line breaks/paragraphs means all of the text gets clumped together as a single brick instead of a nice and formatted message.
Copy link to clipboard
Copied
You can't do that (EDIT: change the title of the window), I'm afraid.
Another option is to use a (read-only) text field and a button field to hide it (and itself). You then add a code to the location I described that sets both fields as visible... Then you will have much more control over how it looks like.
Copy link to clipboard
Copied
That's what I figured I was going to have to do. I was just hoping to try and avoid it.
Maybe I can still tweak some things that will make it work. I have another PDF file where the warning window pops up that has a slightly tweaked title as as well as spaced paragraghs with instructions.
What will I need to do in order to get a script like this to pop up in my document?
Copy link to clipboard
Copied
You can specify the part of the title after the warning like this:
app.alert("Text", 3, 0, "Title")
To be able to use some different fonts and add a check-box like in the screenshot above you'll need to create a Dialog object, which is much more complex than an alert.
Copy link to clipboard
Copied
Really? Like, how much more complex?
Copy link to clipboard
Copied
Quite a bit... It's all documented under the execDialog method of the app object, if you're interested in digging into it.
Copy link to clipboard
Copied
Interesting... how would I access the execDialog in Acrobat Pro?
Copy link to clipboard
Copied
Like this, more or less:
var myDialog = {
// dialog definitions go here
}
app.execDialog(myDialog);
Copy link to clipboard
Copied
To add a line break you need to include this escaped character in the string "\n". For example:
"This is the first line of text.\nThis is the second line of text."
Find more inspiration, events, and resources on the new Adobe Community
Explore Now