These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

javsScript test for Usage Rights

landrew
Registered: Feb 15 2008
Posts: 12

I have several forms that include a submitForm()/ mailDoc() routine which sends a PDF or FDF (depending if using Reader or Acrobat). If the viewer is Reader then I send the data as an FDF as Reader cannot send PDF forms as attachments.

Here is my current script:

if(app.viewerType == "Reader"){
var url = "mailto:"+this.getField("Address").value;
this.submitForm(url,true);
}else{
/* This will send out the mail with the attached PDF file */
var dsubject = this.getField("Subject");
var dmessage = this.getField("Message");
var daddress = this.getField("Address");
this.mailDoc(true, daddress.value, "", "", dsubject.value, dmessage.value);
}

Now that Usage Rights are available, I would like to enable Reader to attach PDF files as email attachments.

Is there a JavaScript function that will test to see if Usage Rights have been enabled for the curent form if opened in Reader?

The issue is that if Reader has Usage Rights enabled I would like to attach a PDF to the email. If Usage Rights are not enabled I will attach the data as an FDF file. I am looking for something like the following:

if((app.viewerType == "Reader" && UsageRights == "Enabled") || app.viewerType != "Reader") {
attach PDF
}else {
attach FDF
}

Thanks in advance.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, there is no direct method to test for Reader Rights Enabling. The idea of course is that since you created the document, you already know whether the PDF has been enabled and should include the proper code.

But, I can see how you might want to write flexible code, so I have an untested suggestion for indirect testing. Basically, try something that will throw an exception if the PDF isn't enabled, like a save. Or you could just go through the Acrobat JavaScript Reference and pick something.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script