On 03/19/12 02:39, iText Info wrote: > Op 18/03/2012 20:36, Larry Evans schreef: >> However, I still can't figure out how to add the /AA: Dictionary. > I didn't follow the complete converstation, but I see that you're > talking about Additional Actions. Did you look this up in the keywords > list of "iText in Action - Second Edition"? > http://itextpdf.com/themes/keyword.php?id=282 > > My first impression of your question is that you've spent a lot of time > figuring something out that was well documented: > http://itextpdf.com/examples/iia.php?id=238 Thank you for your reply.
I have studied the TextFieldActions example which you cited: http://itextpdf.com/examples/iia.php?id=238 In particular, in that example, there's: TextField name = new TextField(writer, new Rectangle(130, 806, 256, 780), "name"); name.setBorderColor(new GrayColor(0.2f)); PdfFormField namefield = name.getTextField(); namefield.setAdditionalActions(PdfName.FO, PdfAction.javaScript( "app.alert('name field got the focus');", writer)); However, my problem is that the .pdf file I'm starting from is: http://www.irs.gov/pub/irs-pdf/f1040.pdf and I couldn't figure a way to get a TextField from that. I could only find a way to get an AcroFields.Item from an AcroFields and a field name; however, I could not figure how to get a PdfFormField from an AcroField.Item which I could then use to setAdditionalActions. I had already looked at several of the examples cited here: http://itextpdf.com/themes/keyword.php?id=282 I used some of those examples for ideas to create the MiniSpreadsheeet.java attached to: http://article.gmane.org/gmane.comp.java.lib.itext.general/61307 Unfortunately, none of the examples, in the keyword.php, except the last: http://itextpdf.com/examples/iia.php?id=238 use AcroField.Item to set an action. I even based my attempts on that example, as noted in the @@2012-03-14.1107CST Changlog entry in the F1040AddAction.java attached to my previous post: http://article.gmane.org/gmane.comp.java.lib.itext.general/61409 A similar use of AcroField.Item to set an action is also found in the ReplaceURL.java; however, that does not attach a javascript action. I tried to mimic as close as possible the AddJavaScriptToForm.java method; however, in that example, the field type is a RadioCheckField, not a TextField; hence, maybe I'm doing something wrong. I have looked at the source for AcroFields.java and the nested Item class and the PdfFromField classes; however, I still can't figure out what I'm doing wrong. I hope that clears up why I'm having problems. -kind regards, Larry ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
