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

Writing a file

LMPIPER
Registered: Apr 4 2007
Posts: 16

I need have the pdf doc write a file on the user’s hard disk. I don't care what is in the file as I only need its presents to indicate the pdf doc has been accessed. I have been trying to do this with Java Script but so far I have failed. I intend to test for this file and if there I will delete it and the dat files that where used to populate the pdf doc fields, (the presents of the file would mean the data has been transferred and is no longer needed).
 
Can you post the code I need to write this Indicator file?
 
I develop the pdf docs with 7 and my users may have 5, 6 or 7.
  
Thanks for your help.
 
Leo

My Product Information:
Acrobat Pro 7.0.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are several Acrobat JavaScript that write a file to the users system. However because of security considerations, when executed from a document script they all require user interaction, i.e. a popup dialog such as the File Save dialog. There are some ways around this restriction, but it's very tricky.

You state "I intend to test for this file and if there I will delete it ". It seems that you have some control over the systems on which you need this action. If this is the case then you have an easy solution. A folder level script with a trusted function. You can call just about any method from a trustedFunction.

var myFunct = app.trustedFunction(function(oDoc, cPath){oDoc.saveAs(cPath);});

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

LMPIPER
Registered: Apr 4 2007
Posts: 16
First thanks for your response.

I am sorry to be so thick headed but I have not been able to get the code to work. I believe because I don’t know what to do with the oDoc and cPath elements of the code. I have tried various things but to no avail. My purpose is to write a file on the users C drive, (C:). I don’t care what kind of file or what is in it, (the less data the better). The presents of the file will mean that the user has accessed the pdf doc. After the users print and close the pdf doc they are returned to the program that called the pdf doc. That is where my macro will be checking for this file and its presents will allow the deletion of the data files used to populate the pdf doc fields and the indicator file on the users C drive.

I am hoping you can show me what I need to do to make this work.


Thanks again

Leo