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

Changing the default SAVE COPY AS location

tclaremont
Registered: Oct 20 2009
Posts: 9

Acrobat 8 in a Wndows environment.

I have done web searches in trying to get this to work, and some responses suggest that it cannot be done. I find this virtually impossible to believe, so let me see if I can phrase my question better than the questions my google search uncovered.

I have an acrobat form on my website that users are expected to fill out. When they hit the SAVE icon, or any SAVE button I place on the form, the default location is SOMETIMES myDocuments on the END USERS computer! Other times it is the location that the file was opened from. I have not discovered why this would change.

I need to dictate the default location for the SAVE AS dialog box to the location where the file came from (which is a network location). It would be completely ludicrous if it were not possible to dictate the default path in the SAVE AS routine, so I am sure I am just missing something obvious.

Editing the registry is not viable. I dont want to change the default location of ALL of the end users documents, just this one. I am open to using JavaScript if need be, but there is absolutely no reason I should have to go to that length for such a rudimentary function.

I must be missing something obvious, so I apologize for my eyesight!

My Product Information:
Acrobat Pro 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There is no way to Set the default Save folder for a couple of reasons. First, PDF files are cross platform and the default directory structures (and event the directory concepts) are very different between Mac, Win, and Unix. The code needed to discover these default locations is priviledged, and is therefore a security violation if run from inside a PDF.

Acrobat is sandboxed. Any contact between functionality on a PDF and things outside the PDF, like the users system, is considered a no-no and it is highly regulated. A PDF could come from anywhere, without direct permission from the user, Acrobat has no way of knowing if a document is a happy friendly PDF or a malicious evil PDF. I'm willing to bet that you would be very unhappy if a random PDF could aquire information about your folder struture without your knowledge.

There are special circumstances where a PDF can save itself off to a specific location on the user's hard drive. But, this requires that the user deliberately setup some special stuff on thier system to allow this.

I suggest you sign up for my eSeminar next week:
http://www.acrobatusers.com/events/1973/tech-talk-form-data-handling

I talk a little bit about saving files.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

tclaremont
Registered: Oct 20 2009
Posts: 9
I don't buy the cross platform complications argument in this case because I merely want to save it to the very same location from where it came, albeit with the changes that the end user committed to the form. Acrobat already knows where the document came from, in this case a network share.

I could understand any inablity to dictate a location on the end users computer, and can see where the cross platform approach would make this a challenge, but alas this is not what I am trying to do.

In anticipation of your next question, I understand that it might be a bad idea to save a modified file over the top of the original, however, this should be left up to the developer to indicate if he/she wants to allow this, rather than Adobe flat out preventing it.


Here is my example... I am developing on my intranet using Adobe ColdFusion.

I have a blank form that needs to be filled out for staff on a particular client.

Upon request, I query a directory on my server to see if the form already exists for that client.

If it exists, I open the existing form and show it to the end user, allowing them to make changes.

If it does NOT exist, I dynamically create a new pdf with the client's information (retrieved from a database), automatically save the PDF to the server (note, as a new document, not over the top of my blank original), and THEN show the client the newly created document. Everything stated so far works great.

I then expect the end user to fill out the form, and hit the save button. The problem is that when they hit the save button, the SAVE AS dialog box defaults to My Documents. I merely want it to default to the location that it came from, on the server. What I want is a SAVE button rather than a SAVE AS button.

So, as you can see, I don't want to do something so potentially dangerous as to save the file on the end user's computer, but rather just save it from the location that it came from. I see that is quite a bit different than attempting to understand the end user's operating system limitations and directory structures, etc, or breaching any security by writing to the end user's computer.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, that's different. The form is operating within a controled environment that you control, you have a couple of options. First, here's the line of code that saves the file back over itself.

this.saveAs(this.path);

This code can only be run from a priviledged context and the path must be a directly folder, not an URL on a local network. You have two options for priviledge. One it to place a folder level script on all the clients. This script must impliment a trusted function that performs the save. The second is to certify the PDF and then load the certifying signature onto each client system. Then the save code can be in the PDF.

But there is something else you can do. Just use the server to save the file. Submit the form data back to the server and use ColdFusion to repopulate the original form and save it.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

tclaremont
Registered: Oct 20 2009
Posts: 9
Thanks for the assistance so far. It is much appreciated.

Currently my save path is as follows:

\\hudson09\wwwroot\participants\485\Client485s

I then determine the file name based on the client number for the form in question, so a typical file name is as follows:

\\hudson09\wwwroot\participants\485\Client485s\485-#ClientNum#.pdf


Are you saying that I cannot use the path illustrated above? I can't get it to work so far.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Whether or not you can use this path depends on the permissions for that folder.

The best way to find out is to do a simple test. Open the console window and run the saveAs on this folder.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

tclaremont
Registered: Oct 20 2009
Posts: 9
I put a button on the form, and assigned the following JavaScript action to the button:

this.saveAs("\\hudson09\wwwroot\participants\485\Client485s\485-#ClientNum#.pdf");

When the button is clicked, absolutely nothing happens. The file is not updated, no error messages, No confirmation of any kind. The end user is left with the impression that they saved the file, due to the complete lack of feedback.

It is not a permissions issue. I have made the folder in question wide open.

Perhaps it is time to look at some of the pdf alternative programs.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

Acrobat uses the "/" for paths not the "\".
You can easily check the path if you open the form from the path you wish to save the form later and then open the console (ctrl+j).
There you type in:
this.path;
For example:
If I open a PDF that is stored on my NAS and use the code above Acrobat returns following the following to the console.
/nas/Data/Test/28082009_102924.pdf

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

tclaremont
Registered: Oct 20 2009
Posts: 9
I have tried it both ways.

In the console, I get "NotAllowedError: Security settings prevent access to this property or method."

This is crazy! I just want to save the document in the exact location that it came from, with the same file name.

If I roll the application out the way it is, people are going to be saving the document in the My Documents folder on their own hard drive. This will make it impossible for other people to see changes. I can't visit every user and teach them how to navigate to the folder in the file server. That would be ridiculous. If I am going to go through that much effort, I might just as well create an HTML form, and submit the data to a database, and eliminate the use of Acrobat altogether.

All I can think is that I am not being clear in explaining how I am going about this, so let me try again.

I have placed a button at the bottom of my PDF form. In the Actions tab of the button properties, I chosen "Mouse Up" as my Select Trigger. I have chosen Run a JavaScript as my Select Action.

When I Edit the action, I have the following:

{
this.saveAs("//hudson09/wwwroot/participants/485/Client485s/485-#ClientNum#.pdf");
}


I then save the file. When I open the file from my web browser, make changes to the file, and then hit the button referenced above, nothing happens. The file does not save. Not even the most basic of industry standard feedback to say that anything happened, or did not happen. No script error indicator in the lower left corner of the browser. Nothing. This leaves people no alternative but to assume that the file saved appropriately.

The next time I open the PDF, however, the changes are not there!

When I open the console, I see the following:

"NotAllowedError: Security settings prevent access to this property or method."


I have checked that I have the latest updates to Acrobat for my version. I have tried it on several different computers. I have ensured that JavaScript is enabled in the browser. I have searched through "Adobe Acrobat 8 PDF Bible" by Ted Padova.

I am flummoxed.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You've got two issues. Acrobat uses a "Device Independant" Path specification. Look at the examples in the JavaScript Reference. Also use the console window for testing your code before placing it in the document. For example to get the current path for the PDF run this code from the console.

this.path

The second problem is that the "saveAs()" function is privileged. It will not run directly from code in the PDF. I believe I explained this in my previous post, and it's pretty clearly spelled out in the Acrobat JavaScript Reference. You'll need to place an automation script on your system.

I'll be talking about this in my eSeminar on Wednesday and providing a SaveAs automation script for free.

http://www.acrobatusers.com/events/1973/tech-talk-form-data-handling

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

tclaremont
Registered: Oct 20 2009
Posts: 9
I am watching the seminar as I type this, but the audio is so choppy that I cant make anything out at all. Not one word. I presume it is archived somewhere?

Update. I downloaded what I needed through the FileShare. Thanks Much!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yeah, for some reason the sound was a problem this time:(. VOIP is bandwidth dependant so who knows what was causing the specific issue. But I'm sure the recording turned out well and will be availible for download in the eSeminars Archive.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

vipero00
Registered: Sep 17 2010
Posts: 3
tclaremont wrote:
snip...
When I Edit the action, I have the following:

{
this.saveAs("//hudson09/wwwroot/participants/485/Client485s/485-#ClientNum#.pdf");
}


The // is the probelm the path should be

{
this.saveAs("/hudson09/wwwroot/participants/485/Client485s/485-#ClientNum#.pdf");
}


I had the same problem and radzmar's suggestion to use this.path
in the console showed me the error of my ways.