Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2007-08-04 12:11:27

jesus
Member
Registered: 2007-04-30
Posts: 2

TypeErrors in saveAs with Adobe Reader

I have the following code in a folder level JS (not the only code):
app.beginPriv();
var myDoc = event.target;

myDoc.saveAs(path, formato);

app.endPriv();
})

It works OK woth Adobe Profesional but with Abobe Reader it gives me the following error:

TypeError: Invalid argument type.
Global.saveAs:18:XFA:topmostSubform[0].Page1[0].PrintButton1[0]:click
===> Parameter cPath.

I noticed that when using Adobe profesional, the variable myDoc is translated to "object Doc" but when using Reader it translate to "object Global". Maybe it has something to do with the problem.

Please help me!! Any Idea???


My Product Information:
Reader Pro 8 / Windows

Offline

 

#2 2007-08-04 14:03:01

thomp
Member

Registered: 2007-04-23
Posts: 703

Re: TypeErrors in saveAs with Adobe Reader

First, this function will only work in Reader if the document has "Save Rights".  Do you have "Save Rights" on the PDF?

What version are you using?  This function is considered an un-safe funtion.  It could be used maliciously, but it's also very useful.  So the restrictions on it have varied with just about every new version.

As for "event.target", this is context dependant.  From where is it being called?  I did a test script calling your function from a menu item and didn't have any problems on either Acrobat or Reader 8.1

Offline

 

#3 2007-08-04 15:02:01

jesus
Member
Registered: 2007-04-30
Posts: 2

Re: TypeErrors in saveAs with Adobe Reader

Thanks!

1- Yes the document has save right. I have tried two ways: 1- Using Adobe Pro Advanced, Enable Usage Right in Adobe reader, 2- Using a provider (Form Router)

2- i'm using Reader 7 and also Reader 8(not sure if is 8.0 or 8.1).

3- The funtion is coded in a folder level Java Script that is called from a button in the form.

Here is the complete .js:

/* saveAs Script */

mySaveAsjpg = app.trustPropagatorFunction(function(doc,path,formato)

{

app.beginPriv();
var myDoc = event.target;
myDoc.saveAs(path, formato);

app.endPriv();
})
myTrustedSpecialTaskFuncjpg = app.trustedFunction(function(doc,path,formato)
{
// privileged and/or non-privileged code above
app.beginPriv();
mySaveAsjpg(doc,path,formato);
app.endPriv();
// privileged and/or non-privileged code below
});
//

This is the instrucction in the button of the form:

MyTrustedSpecialTaskFuncjpg( this, "/c/chieftain/docs/" + FormId.rawValue + ".jpg" , "com.adobe.acrobat.jpeg");


Any advise please!!!!! I'm getting desesperate because this is stopping us from going to producction with my client and the client is very ofsset. I'm cosidering using Adobe Standard instead of Reader.

Waiting for your quiq response!! Will be very appresiated!!

jesus

Offline

 

#4 2007-08-05 11:03:47

jesus
Member
Registered: 2007-04-30
Posts: 2

Re: TypeErrors in saveAs with Adobe Reader

I downloaded Adobe Reader 8.1 and now Im getting this error message:

RaiseErrer: An unimplemented or obsolete function was called. Doc.saveAs

Any help will be appresiated.

Regards,

Jesus

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in