6 Replies Latest reply on Apr 9, 2013 7:17 AM by Plummer_SRC

    Get domain on PDF open

    Plummer_SRC Level 1

      I am trying to prevent a PDF document from displaying if it's location is outside a certain domain. Is this possible in either Acrobat or Livecycle.

        • 1. Re: Get domain on PDF open
          try67 MVP & Adobe Community Professional

          What if someone saves the file to their local computer... Then there is no

          "domain".

          • 2. Re: Get domain on PDF open
            Plummer_SRC Level 1

            Yes, I'd like to document only to display on initiate if the domain is correct. So if they were to save to a local system not within the network it would not display.

            • 3. Re: Get domain on PDF open
              try67 MVP & Adobe Community Professional

              Are you talking about an internet domain (like "adobe.com") or about a

              local network domain?

              • 4. Re: Get domain on PDF open
                Plummer_SRC Level 1

                My apologies, yes a network domain.

                • 5. Re: Get domain on PDF open
                  try67 MVP & Adobe Community Professional

                  Well, the way it can be done is with a script. I'm not sure how your network is set up so I'll give a general example.

                  You look at the path property of the file and do your test on it. If it fails, you close the document. So in the code below I will make sure that the file is located in the folder "C:\Temp", or any of its sub-folders (I'm doing this with the help of a regular expression):

                   

                  if (/^\/c\/temp\//i.test(this.path)==false) this.closeDoc(true);

                   

                  Couple of things to notice:

                  - The internal path syntax of Acrobat is different to the usual one. The path of the file saved as

                  C:\Temp\1.pdf

                  is:

                  /C/temp/1.pdf

                  - This code should be embedded in the document as a doc-level script, outside of any functions, so that it will execute when the file is opened.

                  - This "security measure" can be easily overcome by the user by disabling JS, for example... So use at your own risk.

                  - To find out the path of a file open it in Acrobat then open the JS console (Ctrl+J), enter this code:

                  path

                  and then press Ctrl+Enter.

                  1 person found this helpful
                  • 6. Re: Get domain on PDF open
                    Plummer_SRC Level 1

                    Thank you very much this works in this case.

                    Ideally I'd like to allow authorized users to save documents down to any local folder but only if they are on a networked system and are logged in.

                    To address the JS enabled, the document will be blocked out by default, on open block out is made invisiable so if JS is disabled the doc will not display.