Quantcast

RE: Class Cast exception in writer.addAnnotation(formField2); -- any idea?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Class Cast exception in writer.addAnnotation(formField2); -- any idea?

Paulo Soares
Works for me. What's the stack trace?

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On
> Behalf Of [hidden email]
> Sent: Thursday, July 14, 2005 12:02 AM
> To: [hidden email];
> [hidden email]
> 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/Verizon@VZNotes|
> |         |           Sent by:                        |
> |         |           [hidden email]|
> |         |           ceforge.net                     |
> |         |                                           |
> |         |                                           |
> |         |           07/13/2005 05:00 PM             |
> |         |                                           |
> |---------+------------------------------------------->
>  
> >-------------------------------------------------------------
> -----------------------------------------------------------------|
>   |                                                          
>                                                                    |
>   |       To:       [hidden email],
> [hidden email]                  
>         |
>   |       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
> [hidden email]
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Loading...