I figured it out. No thanks to you guys ;)


Here is what I have in the recordset loop on my jsp page:

 PdfPCell cell; 
 PdfFormField nameField = PdfFormField.createSignature(writer);
 nameField.setWidget(new Rectangle(0, 0, 0, 0),
PdfAnnotation.HIGHLIGHT_INVERT);
 nameField.setFieldName("nameField" + x);
 nameField.setFlags(PdfAnnotation.FLAGS_PRINT);
 cell = new PdfPCell();
 cell.setCellEvent(new FieldCell(nameField,80, writer));
 table1.addCell(cell);



Here is my bean:

package com.test.beans.FieldCell;

import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfAnnotation;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfFormField;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPCellEvent;
import com.lowagie.text.pdf.PdfWriter;


public class FieldCell implements PdfPCellEvent {
        PdfFormField formField;
        PdfWriter writer;
        int width;
        
        public FieldCell(PdfFormField formField, int width, 
                PdfWriter writer){
                this.formField = formField;
                this.width = width;
                this.writer = writer;
        }
        
        public void cellLayout(PdfPCell cell, Rectangle rect, 
                PdfContentByte[] canvas){
                try{                    
                        formField.setWidget(
                                new Rectangle(rect.left(), 
                                        rect.bottom(), 
                                        rect.left()+width, 
                                        rect.top()), 
                                        PdfAnnotation
                                        .HIGHLIGHT_NONE);
                        
                        writer.addAnnotation(formField);
                }catch(Exception e){
                        System.out.println(e);
                }
        }
}
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Adding-empty-signatures-to-a-table-tp2226824p2230613.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to