4 Replies Latest reply on Feb 4, 2016 2:36 AM by ciceroc69199093

    Javascript code for Adobe Acrobat

    ciceroc69199093

      Hi,

       

      I have to use some Javascript code for a PDF file.

      I am just starting learning Javascript but I don't have all the knowledge for now.

       

      Here's my wish I would like : in the file we can see in Viewer Type: Adobe Acrobat.

      If I want to rewrite a text in this place I have to delete "Adobe Acrobat" and then I can write an another.

       

      But my wish is to click in this text "Adobe Acrobat" and when I click on it the text should disappear, and then I can rewrite on it.

      If nothing is written in this part "Adobe Acrobat" should come back.

       

      I don't know if my explication is good.

       

      Thanks for your help.

       

       

       

      Here's the link:

      http://www.planetpdf.com/planetpdf/pdfs/ppjslc_commonex_1.pdf

        • 2. Re: Javascript code for Adobe Acrobat
          ciceroc69199093 Level 1

          Thank you for the link.

          Could you tell me how to put this code

           

           

          // Custom Format script for text field

          if (!event.value) {

          event.value = "Instructional text goes here";

          event.target.display = display.noPrint;

          } else {

          event.target.display = display.visible;

          }

           

          into this

           

          var bAlreadyOpened;

           

          function docOpened()

          {

          if(bAlreadyOpened != "true")

            {

               // document has just been opened, reset form

                            this.resetForm();

           

                            // check version/type

                            var variation = app.viewerVariation;         

                            var version = app.viewerVersion;

                            var variationName = "";

           

                            if(variation == "Reader")

                            {

                                  variationName = "Adobe Reader";

                            }

                            else if(variation == "Full")

                            {

                                  variationName = "Adobe Acrobat";

                            }

                            

                            // now set the form fields to show what type/version is running

                            this.getField("txtType").value = variationName;

                            this.getField("txtVersion").value = app.viewerVersion;

                             

            }

            else

            {

            // document has already been opened

            }

          }

          // call the docOpened() function

          docOpened();

           

           

          Thank you very much

          • 3. Re: Javascript code for Adobe Acrobat
            try67 MVP & Adobe Community Professional

            The two things are unrelated. The code I provided in that thread is meant to be used as the field's On Focus and On Blur events. Your code is a doc-level script.

            • 4. Re: Javascript code for Adobe Acrobat
              ciceroc69199093 Level 1

              OK I understand.

               

              Thanks you very much for your help.