- java.lang.Object
-
- com.itextpdf.text.pdf.PdfPageEventHelper
-
- com.itextpdf.text.pdf.events.FieldPositioningEvents
-
- All Implemented Interfaces:
PdfPageEvent,PdfPCellEvent
public class FieldPositioningEvents extends PdfPageEventHelper implements PdfPCellEvent
Class that can be used to position AcroForm fields.
-
-
Field Summary
Fields Modifier and Type Field Description protected PdfFormFieldcellFieldKeeps the form field that is to be positioned in a cellLayout event.protected PdfWriterfieldWriterThe PdfWriter to use when a field has to added in a cell event.protected java.util.HashMapgenericChunkFieldsKeeps a map with fields that are to be positioned in inGenericTag.floatpaddingSome extra padding that will be taken into account when defining the widget.protected PdfFormFieldparentThe PdfFormField that is the parent of the field added in a cell event.
-
Constructor Summary
Constructors Constructor Description FieldPositioningEvents()Creates a new event.FieldPositioningEvents(PdfFormField parent, PdfFormField field)Creates a new event.FieldPositioningEvents(PdfWriter writer, PdfFormField field)Creates a new event.FieldPositioningEvents(PdfWriter writer, PdfFormField parent, java.lang.String text)Creates a new event.FieldPositioningEvents(PdfWriter writer, java.lang.String text)Creates a new event.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddField(java.lang.String text, PdfFormField field)Add a PdfFormField that has to be tied to a generic Chunk.voidcellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases)This method is called at the end of the cell rendering.voidonGenericTag(PdfWriter writer, Document document, Rectangle rect, java.lang.String text)Called when aChunkwith a generic tag is written.voidsetPadding(float padding)voidsetParent(PdfFormField parent)-
Methods inherited from class com.itextpdf.text.pdf.PdfPageEventHelper
onChapter, onChapterEnd, onCloseDocument, onEndPage, onOpenDocument, onParagraph, onParagraphEnd, onSection, onSectionEnd, onStartPage
-
-
-
-
Field Detail
-
genericChunkFields
protected java.util.HashMap genericChunkFields
Keeps a map with fields that are to be positioned in inGenericTag.
-
cellField
protected PdfFormField cellField
Keeps the form field that is to be positioned in a cellLayout event.
-
fieldWriter
protected PdfWriter fieldWriter
The PdfWriter to use when a field has to added in a cell event.
-
parent
protected PdfFormField parent
The PdfFormField that is the parent of the field added in a cell event.
-
padding
public float padding
Some extra padding that will be taken into account when defining the widget.
-
-
Constructor Detail
-
FieldPositioningEvents
public FieldPositioningEvents()
Creates a new event. This constructor will be used if you need to position fields with Chunk objects.
-
FieldPositioningEvents
public FieldPositioningEvents(PdfWriter writer, PdfFormField field)
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
-
FieldPositioningEvents
public FieldPositioningEvents(PdfFormField parent, PdfFormField field)
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.
-
FieldPositioningEvents
public FieldPositioningEvents(PdfWriter writer, java.lang.String text) throws java.io.IOException, DocumentException
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Throws:
DocumentExceptionjava.io.IOException
-
FieldPositioningEvents
public FieldPositioningEvents(PdfWriter writer, PdfFormField parent, java.lang.String text) throws java.io.IOException, DocumentException
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Throws:
DocumentExceptionjava.io.IOException
-
-
Method Detail
-
addField
public void addField(java.lang.String text, PdfFormField field)Add a PdfFormField that has to be tied to a generic Chunk.
-
setPadding
public void setPadding(float padding)
- Parameters:
padding- The padding to set.
-
setParent
public void setParent(PdfFormField parent)
- Parameters:
parent- The parent to set.
-
onGenericTag
public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, java.lang.String text)
Description copied from class:PdfPageEventHelperCalled when aChunkwith a generic tag is written.It is useful to pinpoint the
Chunklocation to generate bookmarks, for example.- Specified by:
onGenericTagin interfacePdfPageEvent- Overrides:
onGenericTagin classPdfPageEventHelper- Parameters:
writer- thePdfWriterfor this documentdocument- the documentrect- theRectanglecontaining theChunktext- the text of the tag- See Also:
PdfPageEvent.onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
-
cellLayout
public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases)
Description copied from interface:PdfPCellEventThis method is called at the end of the cell rendering. The text or graphics are added to one of the 4PdfContentBytecontained incanvases.
The indexes tocanvasesare:PdfPTable.BASECANVAS- the originalPdfContentByte. Anything placed here will be under the cell.PdfPTable.BACKGROUNDCANVAS- the layer where the background goes to.PdfPTable.LINECANVAS- the layer where the lines go to.PdfPTable.TEXTCANVAS- the layer where the text go to. Anything placed here will be over the cell.
- Specified by:
cellLayoutin interfacePdfPCellEvent- Parameters:
cell- the cellrect- the coordinates of the cellcanvases- an array ofPdfContentByte- See Also:
PdfPCellEvent.cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
-
-