Skip to main content
Participant
February 15, 2012
Question

Acrobat Pro X document open event

  • February 15, 2012
  • 5 replies
  • 19994 views

Hei,

Where I can find document open event. I would like to save my pdf-form when I open it? If there is no  action wizard for this purpose, can somebody tell me how I can script this.

Thanks to your help!

    This topic has been closed for replies.

    5 replies

    Participating Frequently
    February 17, 2012

    Bonjour,

    Are "doc-level" (scripts, which can be found under Tools - JavaScript - Document JavaScripts) only available inAcrobat X version ?

    > How embed a script in a PDF file with Acrobat Pro 9 using tools ?

    > How insert a script in a PDF file with Acrobat Pro 9 using Js ?

    Merci.

    try67
    Community Expert
    Community Expert
    February 17, 2012

    In earlier versions it's under Advanced - Document Processing - Document JavaScripts.

    To add a doc-level script with a script use the addScript method of the Document object, like so:

    this.addScript("init", "app.alert(\"Hello!\");");

    Participating Frequently
    February 17, 2012

    Bonjour,

    1. Thank for your answer

    2. The full “path” : Advanced options > Document Processing > Batch > Create > > Command > JavaScripts…

    (I hope my French to English traduction is ok).

    3. But after few tests : the best answer to my need was to simply use the “Documents processing” possibility of Acrobat !

    I’ve never used this before

    So my conclusion : Reactive forum + Right answer + Good product functionality > GREAT !

    Merci.

    De : try67

    Envoyé : vendredi 17 février 2012 10:02

    À : Troteseil, Lionel

    Objet : Acrobat Pro X document open event

    Re: Acrobat Pro X document open event

    created by try67<http://forums.adobe.com/people/try67> in JavaScript - View the full discussion<http://forums.adobe.com/message/4212492#4212492

    Participating Frequently
    February 16, 2012

    Hi to all, from France !

    Weather is good today from our side, but I have a little cloud in my brain...

    My need (and may be your) is to set up the default/open property of a documents using JavaScripting (in acrobat 9) :

    File > property > initial view :

      - 2 pages (double page)

       - zoom = full page

    If some one get an answer !

    try67
    Community Expert
    Community Expert
    February 16, 2012

    You can't change that property with a script, but you can embed a script in

    the file that will mimic that behavior when the file is opened.

    The code to use is:

    this.layout = "TwoPageLeft";

    this.zoomType = zoomtype.fitP;

    Participating Frequently
    February 16, 2012

    Thank for your QUICK answer.

    And as we said here : “ Merci l’ami ”

    De : try67

    Envoyé : jeudi 16 février 2012 16:27

    À : Troteseil, Lionel

    Objet : Acrobat Pro X document open event

    Re: Acrobat Pro X document open event

    created by try67<http://forums.adobe.com/people/try67> in JavaScript - View the full discussion<http://forums.adobe.com/message/4210628#4210628

    Inspiring
    February 15, 2012

    As noted there is a section for entering document level scripts and these scripts are run when the PDF is opened. There is also a document event for the page open and page close event. The page open action could be used but you might have a variable to control to prevent an action from being run more than one time.

    Unfortunately the 'Save as' action in JavaScript has some restrictions applied to it. It now requires one the use a special application level folder and a special type of function to perform this act.

    try67
    Community Expert
    Community Expert
    February 15, 2012

    There's no Document Open event in PDF files. The equivalent are doc-level

    scripts, which can be found under Tools - JavaScript - Document JavaScripts

    (in Acrobat X). All the code in that location is executed the moment the

    file is opened.

    However, what is the reason for wanting to save at the moment the file is

    opened? Be aware you can't use a script based just in that location to save

    the file under a new name automatically...

    Inspiring
    February 15, 2012

    You can place code in a document-level JavaScript or the initial page's Page Open event and it will execute when the document is opened. Why do you want to save the form when it's opened?