Copy link to clipboard
Copied
Dear Community,
I'm new with JS and Acrobat. I'm looking for a small Code for following Task:
I have an open pdf file and now I need a button to do the following:
Only save the open file in the same directory, but with filename = oldfilename_username.pdf so I can
work with this new file. The old file should be closed. I think I need identity.loginname for username.
Is the best was use an Action with JavaScript Code?
Do you have some Code for me?
Best Regards
Josh
Copy link to clipboard
Copied
Try eliminating the issues I mentioned earlier.
There's no other way to save a file with JS.
Copy link to clipboard
Copied
Hi try67,
on my network drive it doesn't work.
You see this path of my file. But This.SaveAs with this path doesn't work. on my other directory without network drive it works. There must be something other on network drive.
Here you see my whole diretories. Which path do I have to use for saveas?
Copy link to clipboard
Copied
I gave you recommendations on what to try but you keep ignoring them. I can't help you further.
Copy link to clipboard
Copied
I look to your recommendations, but this.path is only helpful for first directories where everything is working.
But now I have network path. There must be something different regarding path?
Copy link to clipboard
Copied
Read my replies again.
Copy link to clipboard
Copied
I read several times your replies, but I don't read something regarding this network path problem?
Copy link to clipboard
Copied
Could be the fact it's on a network drive, or the accented character in the folder name, for example.
Another option could be the "$" symbol in the path name.
Copy link to clipboard
Copied
In my opinion the "$" symbol in the path is the problem. this.path works but
this.saveAs doesn't work with "$".
Is there a workaround or solution for my $ problem?
Copy link to clipboard
Copied
The only solution I can think of is to mount that folder as a drive, for example X:\. Then you could access it directly, like this "/X/<rest of path>".
Copy link to clipboard
Copied
Is there a possibility for Escaping von $ in acrobat? In other programming languages it is possible. For instance in VBA you can write chr(36) for $ sign.
Copy link to clipboard
Copied
This is not really escaping a character, but writing it using its Unicode/ASCII character code, and yes, it is possible, but I don't believe it will solve this issue. You can do it like this:
String.fromCharCode(36)
Copy link to clipboard
Copied
Ok, String.fromCharCode(36) does not help.
Is there another mechanism for handling a $ character in the filename for the saveAs function?
Create Trusted Function or anything else?
Copy link to clipboard
Copied
I don't think so.
Copy link to clipboard
Copied
Ok, I have a solution. I write a powershell script and setting Y: to \\snas302\IDVen$\
Then I use Y in SaveAs and everything is working. But it would be great if acrobat has a solution for SaveAs with $ sign. Can we ask acrobat support?
Copy link to clipboard
Copied
That's exactly what I recommended before...
And no, I don't think that Adobe Support will be able to help you with this. They don't deal with scripting issues.
You can post a feature request/bug report about this issue here, though: https://www.adobe.com/products/wishform.html