Acrobat 6 allows insertions of JavaScript to be run only when: 1)
Document Will Close, 2) Document Will Save, 3) Document Did Save, 4)
Document Will Print, 5) Document Did Print.
However, it does not specify to run it when: "Document Did Open." I
would like to run a JavaScript (expiration date and then a closing
command) immediately when the document opens. Any idea how to do it?
Thanks for your help, Oz.
|
|
0
|
|
|
|
Reply
|
ozshymail (11)
|
11/4/2006 6:53:29 PM |
|
Oz Shy wrote:
> Acrobat 6 allows insertions of JavaScript to be run only when: 1)
> Document Will Close, 2) Document Will Save, 3) Document Did Save, 4)
> Document Will Print, 5) Document Did Print.
These are 'Additional Actions' (PDF Reference 8.5.1 Table 8.43)
> However, it does not specify to run it when: "Document Did Open."
What you need is an 'Open Action' defined in the
Document Catalog (aka root). (PDF Reference 3.6.1).
best regards,
Bruno
--
iText in Action: if you want to know more about iText and PDF:
http://www.manning.com/affiliate/idevaffiliate.php?id=223_53
|
|
0
|
|
|
|
Reply
|
Bruno
|
11/6/2006 8:23:07 AM
|
|
Oz Shy wrote:
> Acrobat 6 allows insertions of JavaScript to be run only when: 1)
> Document Will Close, 2) Document Will Save, 3) Document Did Save, 4)
> Document Will Print, 5) Document Did Print.
>
> However, it does not specify to run it when: "Document Did Open." I
> would like to run a JavaScript (expiration date and then a closing
> command) immediately when the document opens. Any idea how to do it?
> Thanks for your help, Oz.
>
Add a document function like this:
function test ()
{
// your code
}
and remove the lines
function test ()
{
and
}
|
|
0
|
|
|
|
Reply
|
Bernd
|
11/6/2006 9:34:54 AM
|
|
Oz Shy wrote:
> Acrobat 6 allows insertions of JavaScript to be run only when: 1)
> Document Will Close, 2) Document Will Save, 3) Document Did Save, 4)
> Document Will Print, 5) Document Did Print.
>
> However, it does not specify to run it when: "Document Did Open." I
> would like to run a JavaScript (expiration date and then a closing
> command) immediately when the document opens. Any idea how to do it?
> Thanks for your help, Oz.
Oz:
You have two choices.
1) Put your script in the Document Javascripts, but don't call it a
function. (As another said, omit "function(){}"). This will "run"
each time the document is opened, and will also run each time you edit
the Document Javascripts.
2) Add a Page action (Click on the "Pages" tab, right-click on page 1,
select Page Properties and then on the Action tab, add a Javascript
call to your function). This will run each time the page is opened, so
if the document has more than one page, be aware of that.
|
|
0
|
|
|
|
Reply
|
BeenWetter
|
11/6/2006 2:32:29 PM
|
|
Thanks for your help. I understand your option 2) below. However, I
apologize but I fail to understand how to implement your suggested
option 1)?
I'd like to insert an expiration date JavaScript to run immediately
after the document opens:
var d = new Date();
var d1 = util.scand("mm/dd/yy", "11/8/06");
if((d1.valueOf() - d.valueOf()) < 0){
app.alert("Document expired! Please consult www.ozshy.com");
}
Observe that the term "function" does not appear in this script. In
Acrobat 6, JavaScript ---> Set Document Action I cannot do this since I
am restricted to actions of the sort Document will Close. So, how do I
insert the above script so that it will run immediately when the doc
opens? Thanks again, Oz.
On Nov 6, 3:32 pm, "BeenWetter" <budatli...@aol.com> wrote:
> Oz Shy wrote:
> > Acrobat 6 allows insertions of JavaScript to be run only when: 1)
> > Document Will Close, 2) Document Will Save, 3) Document Did Save, 4)
> > Document Will Print, 5) Document Did Print.
>
> > However, it does not specify to run it when: "Document Did Open." I
> > would like to run a JavaScript (expiration date and then a closing
> > command) immediately when the document opens. Any idea how to do it?
> > Thanks for your help, Oz.Oz:
>
> You have two choices.
>
> 1) Put your script in the Document Javascripts, but don't call it a
> function. (As another said, omit "function(){}"). This will "run"
> each time the document is opened, and will also run each time you edit
> the Document Javascripts.
>
> 2) Add a Page action (Click on the "Pages" tab, right-click on page 1,
> select Page Properties and then on the Action tab, add a Javascript
> call to your function). This will run each time the page is opened, so
> if the document has more than one page, be aware of that.
|
|
0
|
|
|
|
Reply
|
Oz
|
11/8/2006 4:05:33 PM
|
|
Oz Shy wrote:
> Thanks for your help. I understand your option 2) below. However, I
> apologize but I fail to understand how to implement your suggested
> option 1)?
>
> I'd like to insert an expiration date JavaScript to run immediately
> after the document opens:
> var d = new Date();
> var d1 = util.scand("mm/dd/yy", "11/8/06");
> if((d1.valueOf() - d.valueOf()) < 0){
> app.alert("Document expired! Please consult www.ozshy.com");
> }
Add this code portion as 'Document Level JavaScript'.
> Observe that the term "function" does not appear in this script.
That's the whole issue. You got the advice twice
to remove "function { ... }" from a sample.
Since you don't have this word/braces, there's
nothing to remove.
> In
> Acrobat 6, JavaScript ---> Set Document Action I cannot do this since I
> am restricted to actions of the sort Document will Close. So, how do I
> insert the above script so that it will run immediately when the doc
> opens? Thanks again, Oz.
As I said before: the best way is to define an
OPEN ACTION in the document catalog.
br,
Bruno
|
|
0
|
|
|
|
Reply
|
Bruno
|
11/8/2006 5:08:16 PM
|
|
Thanks Bruno, I've just realized that for Catalog I need Acrobat 6
Professional (and I use the Standard version). For this reason, I
initially failed to understand the meaning of Document cataloging that
you advised me to use. Oz.
On Nov 8, 6:08 pm, Bruno Lowagie <bruno.lowa...@ugent.be> wrote:
> Oz Shy wrote:
> > Thanks for your help. I understand your option 2) below. However, I
> > apologize but I fail to understand how to implement your suggested
> > option 1)?
>
> > I'd like to insert an expiration date JavaScript to run immediately
> > after the document opens:
> > var d = new Date();
> > var d1 = util.scand("mm/dd/yy", "11/8/06");
> > if((d1.valueOf() - d.valueOf()) < 0){
> > app.alert("Document expired! Please consultwww.ozshy.com");
> > }Add this code portion as 'Document Level JavaScript'.
>
> > Observe that the term "function" does not appear in this script.That's the whole issue. You got the advice twice
> to remove "function { ... }" from a sample.
> Since you don't have this word/braces, there's
> nothing to remove.
>
> > In
> > Acrobat 6, JavaScript ---> Set Document Action I cannot do this since I
> > am restricted to actions of the sort Document will Close. So, how do I
> > insert the above script so that it will run immediately when the doc
> > opens? Thanks again, Oz.As I said before: the best way is to define an
> OPEN ACTION in the document catalog.
> br,
> Bruno
|
|
0
|
|
|
|
Reply
|
Oz
|
11/8/2006 5:29:11 PM
|
|
|
6 Replies
1279 Views
(page loaded in 0.089 seconds)
Similiar Articles: How to run a JavaScript immediately after the document opens ...Acrobat 6 allows insertions of JavaScript to be run only when: 1) Document Will Close, 2) Document Will Save, 3) Document Did Save, 4) Document Will P... Open Word document from Internet Explorer on intranet - comp.lang ...How to run a JavaScript immediately after the document opens ..... However, it does not specify to run it when: "Document Did Open ... How to run a JavaScript ... pdf expiration with javascript - comp.text.pdfHow to run a JavaScript immediately after the document opens ... I'd like to insert an expiration date JavaScript to run immediately after the ... how to execute a .bat from Javascript? - comp.text.pdfHow to run a JavaScript immediately after the document opens ... Acrobat 6 allows insertions of JavaScript to be run only when: 1) Document Will Close, 2) Document Will ... Skip or interrupt startup script - comp.databases.filemaker ...How to run a JavaScript immediately after the document opens ... Skip or interrupt startup script - comp.databases.filemaker ... How to run a JavaScript immediately after ... How to run Notepad and Paste from clipboard to it - comp.lang ...How to run a JavaScript immediately after the document opens ... How to run Notepad and Paste from clipboard to it - comp.lang ... Write the clipboard content to a text ... JavaScript for Acrobat: document.close() does not work - comp.text ...How to run a JavaScript immediately after the document opens ... JavaScript for Acrobat: document.close() does not work - comp.text ... How to run a JavaScript immediately ... IE: Script is causing Internet Explorer to run slowly & ajax ...How to run a JavaScript immediately after the document opens ... IE: Script is causing Internet Explorer to run slowly & ajax ... How to run a JavaScript immediately after ... UTF-8 to Shift JIS - comp.lang.javascriptHow to run a JavaScript immediately after the document opens ... Write the clipboard content to a text file. and than RUN ... think it will be better for them to open in MS ... How to close all started Internet Explorer from perl scripts ...how to execute a .bat from Javascript? - comp ... run file.bat from java - comp.lang.java ... Firefox is already running... - comp.unix.solaris To open a new window, you ... How to run a JavaScript immediately after the document opens ...Acrobat 6 allows insertions of JavaScript to be run only when: 1) Document Will Close, 2) Document Will Save, 3) Document Did Save, 4) Document Will P... How to run a JavaScript immediately after the document opens? - pdfThanks Bruno, I've just realized that for Catalog I need Acrobat 6 Professional (and I use the Standard version). For this reason, I initially failed to understand ... 7/19/2012 3:24:29 PM
|