Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How I can program a Document Close Event

New Here ,
Aug 08, 2018 Aug 08, 2018

I had to set some condition when opening an pdf Dokument. Following is the JavaScript on the field JavaScript for Dokument.

function OpenDocument()

{

   app.runtimeHighlight = false;

}

OpenDocument();

How I can set this back. I need to handle the Document close event. But I don't know how to write this condition.

finally I would like to write.

app.runtimeHighlight = true;

TOPICS
PDF forms
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Aug 09, 2018 Aug 09, 2018

Ah OK, you were translating it back from German to English... Anyway, it's the last command in that list where you'll find the various Document events.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2018 Aug 08, 2018

Look at Tools > JavaScript > Document Actions

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2018 Aug 08, 2018

I would only do that if the runtimeHighlight property is originally set as true. Otherwise, you might be inadvertently reversing the user-selected value, when in fact you're trying to preserve it.

Something like this should work:

var originalRuntimeHighlight = app.runtimeHighlight;

function OpenDocument() {

  if (app.runtimeHighlight)

    app.runtimeHighlight = false;

}

function CloseDocument() {

  app.runtimeHighlight = originalRuntimeHighlight;

}

OpenDocument();

And then from the document's Document Will Close event call CloseDocument.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2018 Aug 09, 2018

Thanks for the code. But I don't really find the close document. I have on my toolbox for javascript following items..

javascript debugger

debugging from beginning

edit all javascript statements

javascript statement for document

define documentation

where I have to put the close statement.

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2018 Aug 09, 2018

What version of Adobe Acrobat do you use?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2018 Aug 09, 2018

Acrobat Professional XI

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2018 Aug 09, 2018

Can you post a screenshot? What you described is not at all what you would find in Acrobat Pro XI...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2018 Aug 09, 2018

Code for the open Document is following as try67 recommanded.

//<Document-Level>

//<ACRO_source>OpenDocument</ACRO_source>

//<ACRO_script>

/*********** gehört zu: Document-Level:OpenDocument ***********/

    var originalRuntimeHighlight = app.runtimeHighlight; 

     

    function OpenDocument() { 

      if (app.runtimeHighlight) 

        app.runtimeHighlight = false; 

    } 

     

    function CloseDocument() { 

      app.runtimeHighlight = originalRuntimeHighlight; 

    } 

     

    OpenDocument(); 

//</ACRO_script>

//</Document-Level>

Screenshot of my JavaScript toolbox is following

AcrobatProfessiona.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2018 Aug 09, 2018

Ah OK, you were translating it back from German to English... Anyway, it's the last command in that list where you'll find the various Document events.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2018 Aug 09, 2018

Thanks try67 it works. Thanks Bernd Alheit for the info.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2018 Aug 09, 2018
LATEST

Thanks try67 also for the code. it speaks a lot of expierence out to consider the settings of the user. and not to change it randomly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2018 Aug 09, 2018

Info: You can use the english UI in the german Acrobat.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines