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<this.numFields; 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 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"
Field.setAction:6:Document-Level:0"
I don't know how to sovle this problem. If you could, please help me on this issue.
Thanks for your reply,
Best Regards,
Tuan.
"Bruno Lowagie (iText)" <[EMAIL PROTECTED]> 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 _javascript_ 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
-------------------------------------------------------------------------
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
How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
------------------------------------------------------------------------- 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