Package com.itextpdf.text.pdf
Class PdfDiv
java.lang.Object
com.itextpdf.text.pdf.PdfDiv
- All Implemented Interfaces:
Spaceable
,Element
,IAccessibleElement
A special element to put a collection of elements at an absolute position.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BaseColor
private Image
private Float
private Float
private PdfDiv.BorderTopStyle
private Float
private float
private float
private PdfDiv.DisplayType
private FloatLayout
private PdfDiv.FloatType
private Float
protected AccessibleElementId
private boolean
Defines if the div should be kept on one page if possibleprivate Float
private float
private float
private float
private float
private Float
private Float
private PdfDiv.PositionType
private Float
protected PdfName
protected int
protected float
The spacing after the table.protected float
The spacing before the table.private int
private Float
private Float
private float
Fields inherited from interface com.itextpdf.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, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(Element element) Get the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).Gets all the properties of accessible element.float
IMPROTANT NOTE: be careful with this method because it would return correct result only in case iflayout(PdfContentByte, boolean, boolean, float, float, float, float)
was already called.float
IMPROTANT NOTE: be careful with this method because it would return correct result only in case iflayout(PdfContentByte, boolean, boolean, float, float, float, float)
was already called.Gets all the chunks in this element.float
float
getId()
boolean
getLeft()
float
float
float
float
getRight()
getRole()
Gets the role of the accessible element.int
float
Gets the spacing after this table.float
Gets the spacing before this table.int
Gets the alignment of this paragraph.getTop()
getWidth()
float
getYLine()
boolean
Checks if this element is a content object.boolean
isInline()
boolean
Checks if this element is nestable.int
layout
(PdfContentByte canvas, boolean useAscender, boolean simulate, float llx, float lly, float urx, float ury) boolean
process
(ElementListener listener) Processes the element by adding it (or the different parts) to anElementListener
.void
setAccessibleAttribute
(PdfName key, PdfObject value) Set the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).void
setBackgroundColor
(BaseColor backgroundColor) void
setBackgroundImage
(Image image) Image will be scaled to fit in the div occupied area.void
setBackgroundImage
(Image image, float width, float height) Image will be scaled to fit in the div occupied area.void
setBorderTopStyle
(PdfDiv.BorderTopStyle borderTopStyle) void
void
setContent
(ArrayList<Element> content) void
setContentHeight
(float contentHeight) void
setContentWidth
(float contentWidth) void
setDisplay
(PdfDiv.DisplayType display) void
setFloatType
(PdfDiv.FloatType floatType) void
void
void
setKeepTogether
(boolean keepTogether) void
void
setPaddingBottom
(float paddingBottom) void
setPaddingLeft
(float paddingLeft) void
setPaddingRight
(float paddingRight) void
setPaddingTop
(float paddingTop) void
setPercentageHeight
(Float percentageHeight) void
setPercentageWidth
(Float percentageWidth) void
setPosition
(PdfDiv.PositionType position) void
void
Sets the role of the accessiblee element.void
setRunDirection
(int runDirection) void
setSpacingAfter
(float spacing) Sets the spacing after this table.void
setSpacingBefore
(float spacing) Sets the spacing before this table.void
setTextAlignment
(int textAlignment) Sets the alignment of this paragraph.void
void
int
type()
Gets the type of the text element.
-
Field Details
-
-
left
-
top
-
right
-
bottom
-
width
-
height
-
percentageHeight
-
percentageWidth
-
contentWidth
private float contentWidth -
contentHeight
private float contentHeight -
textAlignment
private int textAlignment -
paddingLeft
private float paddingLeft -
paddingRight
private float paddingRight -
paddingTop
private float paddingTop -
paddingBottom
private float paddingBottom -
floatType
-
position
-
display
-
floatLayout
-
borderTopStyle
-
yLine
private float yLine -
runDirection
protected int runDirection -
keepTogether
private boolean keepTogetherDefines if the div should be kept on one page if possible -
role
-
accessibleAttributes
-
id
-
backgroundColor
-
backgroundImage
-
backgroundImageWidth
-
backgroundImageHeight
-
spacingBefore
protected float spacingBeforeThe spacing before the table. -
spacingAfter
protected float spacingAfterThe spacing after the table.
-
-
Constructor Details
-
PdfDiv
public PdfDiv()
-
-
Method Details
-
getContentWidth
public float getContentWidth() -
setContentWidth
public void setContentWidth(float contentWidth) -
getContentHeight
public float getContentHeight() -
setContentHeight
public void setContentHeight(float contentHeight) -
getActualHeight
public float getActualHeight()IMPROTANT NOTE: be careful with this method because it would return correct result only in case iflayout(PdfContentByte, boolean, boolean, float, float, float, float)
was already called.- Returns:
- the actual height the div would require to layout it's content
-
getActualWidth
public float getActualWidth()IMPROTANT NOTE: be careful with this method because it would return correct result only in case iflayout(PdfContentByte, boolean, boolean, float, float, float, float)
was already called.- Returns:
- the actual width the div would require to layout it's content
-
getPercentageHeight
-
setPercentageHeight
-
getPercentageWidth
-
setPercentageWidth
-
getDisplay
-
setDisplay
-
getBackgroundColor
-
setBackgroundColor
-
setBackgroundImage
Image will be scaled to fit in the div occupied area. -
setBackgroundImage
Image will be scaled to fit in the div occupied area. -
getYLine
public float getYLine() -
getRunDirection
public int getRunDirection() -
setRunDirection
public void setRunDirection(int runDirection) -
getKeepTogether
public boolean getKeepTogether() -
setKeepTogether
public void setKeepTogether(boolean keepTogether) -
getChunks
Gets all the chunks in this element. -
type
public int type()Gets the type of the text element. -
isContent
public boolean isContent()Description copied from interface:Element
Checks if this element is a content object. If not, it's a metadata object. -
isNestable
public boolean isNestable()Description copied from interface:Element
Checks if this element is nestable.- Specified by:
isNestable
in interfaceElement
- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
process
Processes the element by adding it (or the different parts) to anElementListener
. -
setSpacingBefore
public void setSpacingBefore(float spacing) Sets the spacing before this table.- Specified by:
setSpacingBefore
in interfaceSpaceable
- Parameters:
spacing
- the new spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing) Sets the spacing after this table.- Specified by:
setSpacingAfter
in interfaceSpaceable
- Parameters:
spacing
- the new spacing
-
getSpacingBefore
public float getSpacingBefore()Gets the spacing before this table.- Specified by:
getSpacingBefore
in interfaceSpaceable
- Returns:
- the spacing
-
getSpacingAfter
public float getSpacingAfter()Gets the spacing after this table.- Specified by:
getSpacingAfter
in interfaceSpaceable
- Returns:
- the spacing
-
getTextAlignment
public int getTextAlignment()Gets the alignment of this paragraph.- Returns:
- textAlignment
-
setTextAlignment
public void setTextAlignment(int textAlignment) Sets the alignment of this paragraph.- Parameters:
textAlignment
- the new alignment
-
addElement
-
getLeft
-
setLeft
-
getRight
-
setRight
-
getTop
-
setTop
-
getBottom
-
setBottom
-
getWidth
-
setWidth
-
getHeight
-
setHeight
-
getPaddingLeft
public float getPaddingLeft() -
setPaddingLeft
public void setPaddingLeft(float paddingLeft) -
getPaddingRight
public float getPaddingRight() -
setPaddingRight
public void setPaddingRight(float paddingRight) -
getPaddingTop
public float getPaddingTop()- Specified by:
getPaddingTop
in interfaceSpaceable
-
setPaddingTop
public void setPaddingTop(float paddingTop) - Specified by:
setPaddingTop
in interfaceSpaceable
-
getPaddingBottom
public float getPaddingBottom() -
setPaddingBottom
public void setPaddingBottom(float paddingBottom) -
getFloatType
-
setFloatType
-
getPosition
-
setPosition
-
getContent
-
setContent
-
getBorderTopStyle
-
setBorderTopStyle
-
layout
public int layout(PdfContentByte canvas, boolean useAscender, boolean simulate, float llx, float lly, float urx, float ury) throws DocumentException - Throws:
DocumentException
-
getAccessibleAttribute
Description copied from interface:IAccessibleElement
Get the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).- Specified by:
getAccessibleAttribute
in interfaceIAccessibleElement
- Returns:
-
setAccessibleAttribute
Description copied from interface:IAccessibleElement
Set the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).- Specified by:
setAccessibleAttribute
in interfaceIAccessibleElement
-
getAccessibleAttributes
Description copied from interface:IAccessibleElement
Gets all the properties of accessible element.- Specified by:
getAccessibleAttributes
in interfaceIAccessibleElement
- Returns:
-
getRole
Description copied from interface:IAccessibleElement
Gets the role of the accessible element.- Specified by:
getRole
in interfaceIAccessibleElement
- Returns:
-
setRole
Description copied from interface:IAccessibleElement
Sets the role of the accessiblee element. Set role tonull
if you don't want to tag this element. Note that all child elements won't also be tagged.- Specified by:
setRole
in interfaceIAccessibleElement
-
getId
- Specified by:
getId
in interfaceIAccessibleElement
-
setId
- Specified by:
setId
in interfaceIAccessibleElement
-
isInline
public boolean isInline()- Specified by:
isInline
in interfaceIAccessibleElement
-