Hey,

I need my PDF document to contain several tables.
The purpose of the table is for the client to write text in the TextFields
and for us to gather the written text in the TextField.
All is going rather well except for the following problems.  I'll include an
image as reference as well as the code.

Because the TextFields are wrapped in a PdfPCell the font set in the
TextField doesn't get through.  The font is adjusted by the height of the
cell.  For regular fields this is a minor problem, however I also need a few
much larger fields for memo info.  So anyone filling one of those fields
manually sees a font of at least above 30 points.  How do I get control of
this?
The TextFields are wrapped in the cell because I need to be able to address
the cells both for filling as for reading.  If I fill the cells using a
programatical approach the text is actually in the right font, naturally.

[code]public void addTextField(String name,String value) throws
DocumentException, IOException
    {
      

        table.setLockedWidth(true);
        table.setTotalWidth(540f);               //540f is good
        table.getDefaultCell().setPadding(2f); 
                table.setHorizontalAlignment(Element.ALIGN_LEFT);
            PdfPCell cell;

        table.getDefaultCell().setPaddingLeft(4);
        table.getDefaultCell().setPaddingTop(0);
        table.getDefaultCell().setPaddingBottom(4);

        table.getDefaultCell().setMinimumHeight(15);

        table.addCell(new Phrase(name,wrapFont));
        Rectangle rectangle = new Rectangle(posX,posY,200,20);
        rectangle.setBorder(0);
        TextField textField = new TextField(writer, rectangle,
name+this.huidigVak);
        textField.setBackgroundColor(Color.WHITE);
        textField.setBorderColor(Color.BLACK);
       
        textField.setBorderStyle((int)TextField.BORDER_WIDTH_MEDIUM);
        textField.setText(value);
        textField.setFont(baseFont);
        textField.setAlignment(Element.ALIGN_LEFT);
           
        cell = new PdfPCell();

        cell.setMinimumHeight(20);
        
        FieldPositioningEvents events = new FieldPositioningEvents(writer,
textField.getTextField());
        cell.setCellEvent(events);
        cell.setBorder(1);

        table.addCell(cell);
        cb.stroke();
       
    }[/code]

http://www.nabble.com/file/p17984107/cellfont.jpg 
-- 
View this message in context: 
http://www.nabble.com/PdfPTable-TextField-in-PdfPCell%3A-questions-tp17984107p17984107.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to