Works for me. What's the stack trace? > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Thursday, July 14, 2005 12:02 AM > To: itext-questions@lists.sourceforge.net; > [EMAIL PROTECTED] > Subject: [iText-questions] Class Cast exception in > writer.addAnnotation(formField2); -- any idea? > > > > > > Hi, > I am using this chunk of code to add form fields in an existing pdf. > But I am getting a class Cast Exception > > > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream("c:\\Test.pdf")); > document.open(); > System.out.println("*******"); > PdfContentByte cb = writer.getDirectContent(); > cb.moveTo(0, 0); > > System.out.println(writer.getPageNumber()); > PdfFormField formField2 = > PdfFormField.createTextField(writer, true, true, 0); > int x1 = Integer.parseInt(100); > int x2 = Integer.parseInt(120); > int x3 = Integer.parseInt(120); > int x4 = Integer.parseInt(68); > rect = new Rectangle(x1, x2, x3, x4); > formField2.setWidget(rect, > PdfAnnotation.HIGHLIGHT_INVERT); > > formField2.setFlags(PdfAnnotation.FLAGS_PRINT); > > formField2.setFieldName("SigCustomerSignature"); > formField2.setPage(4); > writer.addAnnotation(formField2); > document.close(); > > I am getting a classCastException in the line > writer.addAnnotation(formField2); > > Any idea, how to get rid of this? > > Thanks, > Anitha > > > > |---------+-------------------------------------------> > | | Anitha D. | > | | Chandran/VEND/TX/[EMAIL PROTECTED]| > | | Sent by: | > | | [EMAIL PROTECTED]| > | | ceforge.net | > | | | > | | | > | | 07/13/2005 05:00 PM | > | | | > |---------+-------------------------------------------> > > >------------------------------------------------------------- > -----------------------------------------------------------------| > | > | > | To: itext-questions@lists.sourceforge.net, > [EMAIL PROTECTED] > | > | cc: > | > | Subject: [iText-questions] Qn on creating Pdf Form > fields in existing pdf | > > >------------------------------------------------------------- > -----------------------------------------------------------------| > > > > > > > > > > Hi, > > I have an existing Pdf ( say x.pdf). > I want to add a few form fields in this Pdf. > > Is there a way to do that? Do you have some examples, you can show me? > > Thanks, > Anitha. > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the > latest in dual > core and dual graphics technology at this free one hour event > hosted by HP, > > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' > webinar happening > July 14 at 8am PDT/11am EDT. We invite you to explore the > latest in dual > core and dual graphics technology at this free one hour event > hosted by HP, > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions >
------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions