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

Acrobat X and acroscript issue

webpointz
Registered: May 21 2009
Posts: 36

Embedded in my PDF is the following javascript:
 
//
//signature:Format
//
/*********** belongs to: AcroForm:signature:Format ***********/
var myPath = '/network_path/' + this.getField('out').value;
this.saveAs(myPath);
this.hostContainer.postMessage(['close']);

//
//
 
This PDF has been certified and signed and extended for Reader. It works fine using previous versions of Acrobat Reader in the browser, however now with Acrobat X, it doesn't work and throws the following error:
 
UnsupportedValueError:
Value is unsupported. ===> Parameter cPath. Doc.saveAs
 
When the PDF is signed, it is supposed to save the file to the network path and then with the "hostContainer" instruction, it prompts the browser to redirect to another page. Acrobat X reader has Enable Protected Mode turned "off". About 1% of the time it works and then the next time it doesn't.
 
Any suggestions?

George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
Just as a test, try turning off Protected Mode in Reader. Does it work now?
webpointz
Registered: May 21 2009
Posts: 36
Protected mode is already off and URLS have been added under security to be trusted
Also, the PDF has been certified and enhanced for reader.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
What's the value of the 'out' field?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

webpointz
Registered: May 21 2009
Posts: 36
The value is just a text string which in this case
is the users name ie. Michael.pdf

As I stated it stopped working using Acrobat X
try67
Expert
Registered: Oct 30 2008
Posts: 2398
From the error message is seems that there's something wrong with the path itself.
Make sure there's actually a ".pdf" suffix, and also that no illegal characters are used (like a comma, or < > : | etc.)

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

webpointz
Registered: May 21 2009
Posts: 36
Yes...the network path and filename are fine...when I uninstall Acrobat X
and install version 9.4 it works flawlessly...same network path and filename...
very frustrating !
try67
Expert
Registered: Oct 30 2008
Posts: 2398
saveAs needs to run from a privileged context. A document-level script is not privileged.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

webpointz
Registered: May 21 2009
Posts: 36
As mentioned...the document is certified and enhanced...I originally
used a document level script but it isn't required on a certified document.

Once again, this runs fine using reader version 9.4
webpointz
Registered: May 21 2009
Posts: 36
Ok...just an update.

When the PDF gets loaded in the browser window, a javascript runs on the HTML page which sets some variables including the FILENAME so it is specific to the user, and these variables are then immediately posted to the PDF using the following code (the page has FORM fields with hidden values that are populated):

function UpdatePDF() {

// Set values to variables to pass to PDF
var cmt = 'cmt' + document.getElementById('Comment').value;
var out = 'out' + document.getElementById('FileName').value;

var PDFObject = document.getElementById("PdfHost");
if (PDFObject != null)
PDFObject.postMessage([cmt,out]);
}

When the user signs the PDF, it uses the OUT variable to add onto the end of the network path being used.
When I added an APP.ALERT(myPath) prior to saving, in some cases it shows the full network path + filename and occassionally only shows the network path and NO filename on the end, thus the error message because there is no filename.


webpointz
Registered: May 21 2009
Posts: 36
It seems like with Acrobat X, the UpdatePDF() javascript function when fired doesn't always send the variables to the PDF for some reason.

But if the page is REFRESHED, the variables that are visible show up on the page refresh for some reason or another but ONLY with Acrobat X.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Please submit a bug report to Adobe support:

Feature Request/Bug Report Formhttps://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

George Kaiser

webpointz
Registered: May 21 2009
Posts: 36
Thanks...this is so intermittent. One minute it works and then another time it doesn't send the variables to the PDF. Definitely something buggy. It doesn't matter whether it's in IE8 or Firefox either.

It appears to be the hostContainer object...

I believe it is the error "MessageGeneralError: Operation failed." but that's a pretty generic error.
webpointz
Registered: May 21 2009
Posts: 36
Just an update...for the time being it appears to be a "syncing" issue with communication. I added a javascript timedelay to push the values from the browser to the PDF and this part seems to work.