8 Replies Latest reply on Mar 15, 2011 5:19 PM by Bruce Hensley

    Basics: Save Rights Enabled for Reader

    sam452

      I have an involved Applescript that handles/creates pdfs for our clients. The only thing I need Acrobat Pro 9.4 to do is to create the Rights Enabled option for Reader and save as into a new file. Ideally, without having to use the GUI interface.

       

      Reading up on the API, every reference to Rights Enabled seems to be in the context of Forms, or Live Cycle. None of those would seem to be required? And there are several atomic levels that can be rights enabled, it seems, which is good. Even if I have none of these environments, is the effect of the menu command of "Enable Rights ..." the same as saving each of these options to a new pdf? I'm assuming this is an application level javascript?

       

      Starting to work the javascript examples in the API is frustrating because everything after "var jsNum = 10" fails to seem to work and the errors reported don't make sense in the context I'm seeing them. i'm not dumb, just inexperienced with javascript. Its frustrating when the examples copied and pasted error out, etc.

       

      Some pointers to guides that give me better context would be appreciated, so as not to clog the forum with newbie chatter, thanx, sam

        • 1. Re: Basics: Save Rights Enabled for Reader
          George_Johnson MVP & Adobe Community Professional

          You cannot automate Acrobat to enable usage rights. It is a manual process. The only way to automate adding usage rights is to use Adobe's LiveCycle Reader Extensions server-based software.

           

          Usage rights are often mentioned with forms because they allow Reader to save filled-in forms, which is a common thing to do. Why are you adding them?

           

          Regarding JavaScript, it would help if you provided an example that doesn't work and explain how you're using it and what you want it to do.

          1 person found this helpful
          • 2. Re: Basics: Save Rights Enabled for Reader
            sam452 Level 1

            Thanks for explaining why I couldn't determine this.

             

            Thanks for the offer of explaining what I'm seeing with the basic API examples. The second one is here, from page 51, example 4.2 of the Adobe Acrobat SDK document:

             

            // Create a new PDF document:

            var newDoc = app.newDoc();

            // Insert doc1.pdf:

            newDoc.insertPages({

            nPage: -1,

            cPath: "Macintosh HD:tmp:1.pdf",

            });

            // Insert doc2.pdf:

            newDoc.insertPages({

            nPage: newDoc.numPages-1,

            cPath: "Macintosh HD:tmp:2.pdf",

            });

            // Save the new document:

            newDoc.saveAs({

            cPath: "Macintosh HD:tmp:11.pdf";

            });

            // Close the new document without notifying the user:

            newDoc.closeDoc(true);

            SyntaxError: missing } after property list

            13:Console:Exec

            undefined

             

            OK, counting lines it appears to be after the newDoc.close statement. But to my way of thinking all the braces, parentheses are closed.

             

            I tried removing the returns after each cPath statement thinking perhaps I shouldn't have a return before the closing }); a long shot. Looking at my /tmp directory, I don't see a new pdf called 11.pdf.

             

            Clearly, there's something basic I'm missing here that I'm unaware of the context, thanx, sam

            • 3. Re: Basics: Save Rights Enabled for Reader
              George_Johnson MVP & Adobe Community Professional

              None of those paths are specified correctly. They should look like:

               

              cPath: "/Macintosh HD/tmp/1.pdf"

               

              Note there is not a comma after it as well.

               

              And this one:

               

              cPath: "Macintosh HD:tmp:11.pdf";

               

              should be:

               

              cPath: "/Macintosh HD/tmp/11.pdf"

               

              That is, no semicolon at the end.

              • 4. Re: Basics: Save Rights Enabled for Reader
                sam452 Level 1

                Thank you for taking time to look this basic thing over.

                 

                The below fails as well:

                 

                // Create a new PDF document:

                var newDoc = app.newDoc();

                // Insert doc1.pdf:

                newDoc.insertPages({

                nPage: -1,

                cPath: "/Macintosh HD/tmp/1.pdf"

                });

                // Insert doc2.pdf:

                newDoc.insertPages({

                nPage: newDoc.numPages-1,

                cPath: "/Macintosh HD/tmp/2.pdf"

                });

                // Save the new document:

                newDoc.saveAs({

                cPath: "/Macintosh HD/tmp/11.pdf";

                });

                // Close the new document without notifying the user:

                newDoc.closeDoc(true)

                 

                -->SyntaxError: missing } after property list

                -->15:Console:Exec

                -->undefined

                 

                The slash in front Macintosh HD throws me as UNIX doesn't have that form. Either way, it fails. What am I overlooking? With removing the commans after the first two cPath's, removing the semicolon at the end, I seem to be straying from the example copied from the SDK's example?

                 

                thanx, sam

                • 5. Re: Basics: Save Rights Enabled for Reader
                  George_Johnson MVP & Adobe Community Professional

                  The problemm is this line:

                   

                      newDoc.saveAs({cPath: "/Macintosh HD/tmp/11.pdf";});

                   

                   

                  There should be no semicolon in the middle there, only at the end.

                   

                  Also, where have you placed this code, exactly? The saveAs method will only work in a privileged context, such as theJavaScript console or a folder-level script. With the latter, it needs to be in a trusted function and enclosed by app.beginPriv and app.endPriv statements. See the Acrobat JavaScript Reference for more information on the doc.saveAs method

                   

                  Regarding the path, that's know as a device independant path.

                  • 6. Re: Basics: Save Rights Enabled for Reader
                    sam452 Level 1

                    Yes, that's the deal. You're right, I have a lot to learn. The script was placed in the console and based on my reading that runs as privileged. I'm learning that  there are safe paths to watch for. That's why I used my root's /tmp folder.

                     

                    I've now learned that the paths are structured that way for platform independence.

                     

                    But why all the extra semicolons in the Adobe tutorial? I don't expect an answer to that, but as I dig through this document, I would appreciate understanding what I s/b looking out for in these judicious uses of the semicolons. I'm sure there's a deeper discussion of javascript there, but any bones you can throw my way would be helpful, thanx, sam

                    • 7. Re: Basics: Save Rights Enabled for Reader
                      George_Johnson MVP & Adobe Community Professional

                      Semicolons are used in JavaScript to terminate statements, as well as to terminate the initialize and test expressions in a for loop, e.g.:

                       

                      for (var i = 0; i < 10; i++) {

                       

                       

                      They are actually optional as statement terminators in JavaScript, and you'll see them left out a lot, but it's a good idea to get in the habit of always including them. Leaving them out can cause subtle bugs that can be difficult to track down. Still, some prefer the cleaner look of the code without them. It just looks wrong to me without them.

                      • 8. Re: Basics: Save Rights Enabled for Reader
                        Bruce Hensley

                        This is probably too old to be of value, but when we heard the same story about enabling PDFs for review in Reader 7, we found that using PDF open parameters and placing the files and comment repository on an IIS FILEserver (not web or WebDav server) got around the need to enable them at all.

                         

                        Here is an example link to a PDF to be reviewed in Reader 7. You may want to try the approach,

                         

                        <A href="file://server/share/path/MyFileName.pdf#collab=FSFDF@//server/share2/CommentRepositoryFold er">MyFileName.pdf</A>