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

How to determine if a PDF file is read-only

csommer
Registered: Jun 11 2006
Posts: 28

If a form is sent as a mail attachment is first has to be saved to a location before it can be signed. Is there a way of determining the read-only status of the file through JavaScript so that the user can be prompted to save the file in another folder when the form is opened as an attachment in the email? I'd prefer to avoid using a hidden status field and would like access the property directly to determine if the document must be saved elsewhere or not.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
When I sign a PDF that was opened from an email it prompts me to save the file after I've gone through the signing process. If I simply change the name is saves. If I don't change the name, Acrobat displays a error message and aborts the signing.

The problem here is that the file is placed in a temporary folder before being opened in Acrobat. Outlook makes this file ReadOnly.

There is no way from Acrobat JavaScript in the document to determine the ReadOnly status of a PDF. At least not a direct method like a property or function. You can get clever and try doing something that will pass or fail depending on the status, but I don't have any idea right off on how you might go about it.

The easiest way to detect this situation is to examine the file path. If the word temp or temporary is in the path then it's a good bet that the file is in a temporary folder. Even if the file is not ReadOnly it's a good idea not to operate on temporary files. So you can use a popup to tell the user to save the file to a non temporary folder before doing anything to it.

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