org.ujac.print.tag.acroform
Class FloatingFormElement

java.lang.Object
  extended by com.lowagie.text.pdf.PdfPTable
      extended by org.ujac.print.tag.acroform.FloatingFormElement
All Implemented Interfaces:
com.lowagie.text.Element, com.lowagie.text.LargeElement, com.lowagie.text.pdf.PdfPCellEvent

public class FloatingFormElement
extends com.lowagie.text.pdf.PdfPTable
implements com.lowagie.text.pdf.PdfPCellEvent

This class is an enhancement to the iText libary. iText doesn't support the relative placement of form elements. This class is a workaround: We place a table in the size of the desired form element in the document and register a PdfPCellEvent listener. The listener is called when the table is positioned in the document. We change the position of the form to the position of the table. That this works we need to use the following order:
Create a form element:
TextField tf = new TextField(pdfWriter, new Rectangle(x, y, x + width, y + height), fieldName);
...do the layout of field...

Create the FloatingFormElement:
FloatingFormElement element = new FloatingFormElement(tf.getTextField(), pdfWriter);

Add the form element to reserve a place:
document.add(element);

The annotation is added automaticly.

Author:
pschweizer

Field Summary
 
Fields inherited from class com.lowagie.text.pdf.PdfPTable
absoluteWidths, BACKGROUNDCANVAS, BASECANVAS, complete, currentRow, currentRowIdx, defaultCell, headerRows, isColspan, LINECANVAS, relativeWidths, rows, runDirection, spacingAfter, spacingBefore, tableEvent, TEXTCANVAS, totalHeight, totalWidth, widthPercentage
 
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
 
Constructor Summary
FloatingFormElement(BaseAcroFieldTag tag, com.lowagie.text.pdf.PdfWriter writer, float width, float height)
           
 
Method Summary
 void cellLayout(com.lowagie.text.pdf.PdfPCell cell, com.lowagie.text.Rectangle pos, com.lowagie.text.pdf.PdfContentByte[] canvases)
          Will be called by the table, no need to call this method by user.
 
Methods inherited from class com.lowagie.text.pdf.PdfPTable
addCell, addCell, addCell, addCell, addCell, beginWritingRows, calculateHeightsFast, completeRow, deleteBodyRows, deleteLastRow, deleteRow, endWritingRows, flushContent, getAbsoluteWidths, getChunks, getDefaultCell, getFooterHeight, getFooterRows, getHeaderHeight, getHeaderRows, getHorizontalAlignment, getKeepTogether, getNumberOfColumns, getRow, getRowHeight, getRows, getRunDirection, getTableEvent, getTotalHeight, getTotalWidth, getWidthPercentage, isComplete, isContent, isExtendLastRow, isHeadersInEvent, isLockedWidth, isNestable, isSkipFirstHeader, isSplitLate, isSplitRows, process, setComplete, setExtendLastRow, setFooterRows, setHeaderRows, setHeadersInEvent, setHorizontalAlignment, setKeepTogether, setLockedWidth, setRunDirection, setSkipFirstHeader, setSpacingAfter, setSpacingBefore, setSplitLate, setSplitRows, setTableEvent, setTotalWidth, setTotalWidth, setWidthPercentage, setWidthPercentage, setWidths, setWidths, shallowCopy, size, spacingAfter, spacingBefore, type, writeSelectedRows, writeSelectedRows, writeSelectedRows, writeSelectedRows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.Element
toString
 

Constructor Detail

FloatingFormElement

public FloatingFormElement(BaseAcroFieldTag tag,
                           com.lowagie.text.pdf.PdfWriter writer,
                           float width,
                           float height)
Method Detail

cellLayout

public void cellLayout(com.lowagie.text.pdf.PdfPCell cell,
                       com.lowagie.text.Rectangle pos,
                       com.lowagie.text.pdf.PdfContentByte[] canvases)
Will be called by the table, no need to call this method by user.

Specified by:
cellLayout in interface com.lowagie.text.pdf.PdfPCellEvent


Copyright © 2003-2004 UJAC.org. All Rights Reserved.