The value must be a name not a string.

----- Original Message ----- 
From: "wang yun" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, January 02, 2005 6:48 AM
Subject: [iText-questions] Re: iText-questions digest, Vol 1 #2541 - 4 msgs


> Dear Support,
> 
> I want to add 3 check boxs with the FieldName
> "CreditCard1". I want to "Visa" to be the default
> value and checked.  The new pdf "out.pdf" looks OK. 
> 
> But, as I use: String value =
> form.getField("CreditCard1") to get the value of this
> check box. The return value is empty.
> 
> Please do me a favor to look at my code. I really
> apprecaite your time to help me. 
> 
> Thanks and happy new year!
> 
> yun wang
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ByteArrayOutputStream baos = null;
> Document document = null;
> PdfReader reader = null;
> PdfContentByte cb = null;
> PdfCopy copier = null;
> PdfImportedPage page = null;
> PdfStamper stamp = null;
> int cntPages;
> 
> reader = new PdfReader("test.pdf");
>        cntPages = reader.getNumberOfPages();
>         stamp = new PdfStamper(reader, new
> FileOutputStream("out.pdf")); 
> 
> PdfWriter writer = stamp.getWriter();
> 
> for (int i = 1; i <= 1; i++) 
> { 
> cb = stamp.getOverContent(i);
> cb.moveTo(0, 0);
>             
> //PdfFormField radio =
> PdfFormField.createRadioButton(writer, true);
> PdfFormField radio =
> PdfFormField.createCheckBox(writer);
> 
> PdfAppearance tpOff1 = cb.createAppearance(20,
> 20);
> PdfAppearance tpOn1 = cb.createAppearance(20, 20);
> 
> PdfAppearance tpOff2 = cb.createAppearance(30,
> 30);
> PdfAppearance tpOn2 = cb.createAppearance(30, 30);
> 
> PdfAppearance tpOff3 = cb.createAppearance(40,
> 40);
> PdfAppearance tpOn3 = cb.createAppearance(40, 40);
>             
> tpOff1.circle(10, 10, 9);
> tpOff1.stroke();
> tpOn1.circle(10, 10, 9);
> tpOn1.stroke();
> tpOn1.circle(10, 10, 3);
> tpOn1.fillStroke();
> 
> tpOff2.circle(15, 15, 9);
> tpOff2.stroke();
> tpOn2.circle(15, 15, 9);
> tpOn2.stroke();
> tpOn2.circle(15, 15, 3);
> tpOn2.fillStroke();
> 
> tpOff3.circle(20, 20, 9);
> tpOff3.stroke();
> tpOn3.circle(20, 20, 9);
> tpOn3.stroke();
> tpOn3.circle(20, 20, 3);
> tpOn3.fillStroke();
> 
> radio.setFieldName("CreditCard1");
> radio.setValueAsString("Visa");
> 
> PdfFormField radio1 =
> PdfFormField.createEmpty(writer);
> radio1.setWidget(new Rectangle(200, 700, 220,
> 720), PdfAnnotation.HIGHLIGHT_INVERT);
> radio1.setAppearanceState("Off");
> 
> radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "Off", tpOff1);
> 
> radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "MasterCard",  tpOn1);
> radio.addKid(radio1);
>         
> PdfFormField radio2 =
> PdfFormField.createEmpty(writer);
> radio2.setWidget(new Rectangle(200, 610, 230,
> 640), PdfAnnotation.HIGHLIGHT_INVERT);
> radio2.setAppearanceState("Visa");
> 
> radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "Off", tpOff2);
> 
> radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "Visa", tpOn2);
> radio.addKid(radio2);
>             
> PdfFormField radio3 =
> PdfFormField.createEmpty(writer);
> radio3.setWidget(new Rectangle(200, 520, 240,
> 560), PdfAnnotation.HIGHLIGHT_INVERT);
> radio3.setAppearanceState("Off");
> 
> radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "Off", tpOff3);
> 
> radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
> "American", tpOn3);
> radio.addKid(radio3);
>         
> stamp.addAnnotation(radio, 1);
> 
> }
> 
> stamp.close();
> 
> 
> 


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to