> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of AnhTuan Nguyen
> Sent: Wednesday, October 04, 2006 2:46 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] How to launch javascript code 
> for PDFformfields event.
> 
> Hi Paulo,
> Thanks a lot for your help,
>  
> According to your reply, i must put the javacript code in XFA 
> ( in case that Designa form was used). I'm wondering that we 
> can use Itext's API to do this?
> If yes, please help me know some guides.
>  

XfaForm xfa = acroFields.getXfa();
XfaForm.Xml2SomTemplate tp = xfa.getTemplateSom();
Node n = (Node)tp.getName2Node("form1[0].#subform[0].TextField1[0]");
xfa.setChanged(true);

In this Node you'll have to change/set the <event> element. This is explained 
in page 470 of the XFA 2.2 reference.

Paulo



> Best Regards,
> Tuan    
> 
> Paulo Soares <[EMAIL PROTECTED]> wrote:
> 
> 
> 
>       > -----Original Message-----
>       > From: [EMAIL PROTECTED] 
>       > [mailto:[EMAIL PROTECTED] On 
>       > Behalf Of AnhTuan Nguyen
>       > Sent: Tuesday, October 03, 2006 10:21 AM
>       > To: Post all your questions about iText here
>       > Subject: Re: [iText-questions] How to launch javascript code 
>       > for PDF formfields event.
>       > 
>       > Hi Bruno,
>       > Right now, i have found out the way to attach the javascript 
>       > code for form field event. The method PDFStamper.addScript() 
>       > and PDF javascript at document level was used to that. The 
>       > script is below:
>       > 
>       > var f; var count = 0; 
>       > for ( var i=0; i
>       > var fname = this.getNthFieldName(i);
>       > f =this.getField(fname); 
>       > console.println("There are:" + f.name); 
>       > f.setAction("MouseUp","app.alert('Thanks for selecting the 
>       > first choice.')"); 
>       > }
>       > 
>       > But i'm only sucessful in case that PDF form created by 
>       > itext. Otherwise, It will be failed in case that PDF form 
>       
>       It's not iText specific, it's called an Acrobat form as 
> opposed to a
>       Designer form.
>       
>       > created by Acrobat Designer. This is an message message:
>       > 
>       > "NotAllowedError: Security settings prevent access to this 
>       > property or method.
>       > Field.setAction:6:Document-Level:0" 
>       > I don't know how to sovle this problem. If you could, please 
>       > help me on this issue.
>       >
>       
>       Designer forms are a completely different beast. You'll 
> have to put the
>       javascript in the XFA. See
>       
> http://partners.adobe.com/public/developer/en/xml/xfa_spec_2_4.pdf.
>       
>       Paulo
>       
>       > Thanks for your reply,
>       > Best Regards,
>       > Tuan.
>       > 
>       > 
>       > "Bruno Lowagie (iText)" wrote:
>       > 
>       > AnhTuan Nguyen wrote:
>       > > Thanks for your reply quickly,
>       > > I can do as your description, but i would like to 
>       > know the way how to 
>       > > get the existing form field, and add the java script 
>       > code for this field.
>       > > I can't find out the any methods in order to get 
>       > existing form field.
>       > 
>       > That's too difficult to explain in a mail message.
>       > 
>       > I have a very small example in chapter 18 of the book,
>       > but this example won't help you if you haven't read
>       > the other chapters.
>       > 
>       > You need PdfReader and PdfStamper, you need to know
>       > how to find the PDF objects (dictionaries) that describe
>       > the form field, and you need to read the specific chapters
>       > on form fields in the PDF Reference.
>       > 
>       > br,
>       > Bruno
>       
>       
>       Aviso Legal:
>       Esta mensagem é ¤estinada exclusivamente ao 
> destinatᲩo. Pode conter informa磯 confidencial ou 
> legalmente protegida. A incorrecta transmiss㯠desta mensagem 
> n㯠significa a perca de confidencialidade. Se esta mensagem 
> for recebida por engano, por favor envie-a de volta para o 
> remetente e apague-a do seu sistema de imediato. É proibido a 
> qualquer pessoa que n㯠o destinatᲩo de usar, revelar ou 
> distribuir qualquer parte desta mensagem. 
>       
>       Disclaimer:
>       This message is destined exclusively to the intended 
> receiver. It may contain confidential or legally protected 
> information. The incorrect transmission of this message does 
> not mean the loss of its confidentiality. If this message is 
> received by mistake, please send it back to the sender and 
> delete it from your system immediately. It is forbidden to 
> any person who is not the intended receiver to use, 
> distribute or copy any part of this message.
>       
>       
>       
> --------------------------------------------------------------
> -----------
>       Take Surveys. Earn Cash. Influence the Future of IT
>       Join SourceForge.net's Techsay panel and you'll get the 
> chance to share your
>       opinions on IT & business topics through brief surveys 
> -- and earn cash
>       
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
> &CID=DEVDEV_______________________________________________
>       iText-questions mailing list
>       iText-questions@lists.sourceforge.net
>       https://lists.sourceforge.net/lists/listinfo/itext-questions
>       
> 
> 
> ________________________________
> 
> Get your own web address for just $1.99/1st yr 
> <http://us.rd.yahoo.com/evt=43290/*http://smallbusiness.yahoo.
> com/domains> . We'll help. Yahoo! Small Business 
> <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/> . 
> 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to