Package com.lowagie.text.pdf.events
Class FieldPositioningEvents
java.lang.Object
com.lowagie.text.pdf.PdfPageEventHelper
com.lowagie.text.pdf.events.FieldPositioningEvents
- All Implemented Interfaces:
PdfPageEvent
,PdfPCellEvent
Class that can be used to position AcroForm fields.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PdfFormField
Keeps the form field that is to be positioned in a cellLayout event.protected PdfWriter
The PdfWriter to use when a field has to added in a cell event.protected Map
<String, PdfFormField> Keeps a map with fields that are to be positioned in inGenericTag.float
Some extra padding that will be taken into account when defining the widget.protected PdfFormField
The PdfFormField that is the parent of the field added in a cell event. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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, String text) Creates a new event.FieldPositioningEvents
(PdfWriter writer, String text) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(String text, PdfFormField field) Add a PdfFormField that has to be tied to a generic Chunk.void
cellLayout
(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases) This method is called at the end of the cell rendering.void
onGenericTag
(PdfWriter writer, Document document, Rectangle rect, String text) Called when aChunk
with a generic tag is written.void
setPadding
(float padding) void
setParent
(PdfFormField parent) Methods inherited from class com.lowagie.text.pdf.PdfPageEventHelper
onChapter, onChapterEnd, onCloseDocument, onEndPage, onOpenDocument, onParagraph, onParagraphEnd, onSection, onSectionEnd, onStartPage
-
Field Details
-
padding
public float paddingSome extra padding that will be taken into account when defining the widget. -
genericChunkFields
Keeps a map with fields that are to be positioned in inGenericTag. -
cellField
Keeps the form field that is to be positioned in a cellLayout event. -
fieldWriter
The PdfWriter to use when a field has to added in a cell event. -
parent
The PdfFormField that is the parent of the field added in a cell event.
-
-
Constructor Details
-
FieldPositioningEvents
public FieldPositioningEvents()Creates a new event. This constructor will be used if you need to position fields with Chunk objects. -
FieldPositioningEvents
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Parameters:
writer
- The PdfWriterfield
- The field to label the Event
-
FieldPositioningEvents
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Parameters:
parent
- The parent of the Eventfield
- The field to label the Event
-
FieldPositioningEvents
Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Parameters:
writer
- The PdfWritertext
- The text to label the TextField- Throws:
DocumentException
- thrown when an error occurs in a DocumentIOException
- throw when an I/O operation fails
-
FieldPositioningEvents
public FieldPositioningEvents(PdfWriter writer, PdfFormField parent, String text) throws IOException, DocumentException Creates a new event. This constructor will be used if you need to position fields with a Cell Event.- Parameters:
writer
- The PdfWriterparent
- The parent of the new eventtext
- The label of the event- Throws:
DocumentException
- thrown when an error occurs in a DocumentIOException
- throw when an I/O operation fails
-
-
Method Details
-
addField
Add a PdfFormField that has to be tied to a generic Chunk.- Parameters:
text
- The textfield
- The PdfFormField
-
setPadding
public void setPadding(float padding) - Parameters:
padding
- The padding to set.
-
setParent
- Parameters:
parent
- The parent to set.
-
onGenericTag
Description copied from class:PdfPageEventHelper
Called when aChunk
with a generic tag is written.It is useful to pinpoint the
Chunk
location to generate bookmarks, for example.- Specified by:
onGenericTag
in interfacePdfPageEvent
- Overrides:
onGenericTag
in classPdfPageEventHelper
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentrect
- theRectangle
containing theChunk
text
- the text of the tag- See Also:
-
cellLayout
Description copied from interface:PdfPCellEvent
This method is called at the end of the cell rendering. The text or graphics are added to one of the 4PdfContentByte
contained incanvases
.
The indexes tocanvases
are: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:
cellLayout
in interfacePdfPCellEvent
- Parameters:
cell
- the cellrect
- the coordinates of the cellcanvases
- an array ofPdfContentByte
- See Also:
-