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 enumstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BaseColorprivate Imageprivate Floatprivate Floatprivate PdfDiv.BorderTopStyleprivate Floatprivate floatprivate floatprivate PdfDiv.DisplayTypeprivate FloatLayoutprivate PdfDiv.FloatTypeprivate Floatprotected AccessibleElementIdprivate booleanDefines if the div should be kept on one page if possibleprivate Floatprivate floatprivate floatprivate floatprivate floatprivate Floatprivate Floatprivate PdfDiv.PositionTypeprivate Floatprotected PdfNameprotected intprotected floatThe spacing after the table.protected floatThe spacing before the table.private intprivate Floatprivate Floatprivate floatFields inherited from interface 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 TypeMethodDescriptionvoidaddElement(Element element) Get the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).Gets all the properties of accessible element.floatIMPROTANT 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.floatIMPROTANT 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.floatfloatgetId()booleangetLeft()floatfloatfloatfloatgetRight()getRole()Gets the role of the accessible element.intfloatGets the spacing after this table.floatGets the spacing before this table.intGets the alignment of this paragraph.getTop()getWidth()floatgetYLine()booleanChecks if this element is a content object.booleanisInline()booleanChecks if this element is nestable.intlayout(PdfContentByte canvas, boolean useAscender, boolean simulate, float llx, float lly, float urx, float ury) booleanprocess(ElementListener listener) Processes the element by adding it (or the different parts) to anElementListener.voidsetAccessibleAttribute(PdfName key, PdfObject value) Set the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).voidsetBackgroundColor(BaseColor backgroundColor) voidsetBackgroundImage(Image image) Image will be scaled to fit in the div occupied area.voidsetBackgroundImage(Image image, float width, float height) Image will be scaled to fit in the div occupied area.voidsetBorderTopStyle(PdfDiv.BorderTopStyle borderTopStyle) voidvoidsetContent(ArrayList<Element> content) voidsetContentHeight(float contentHeight) voidsetContentWidth(float contentWidth) voidsetDisplay(PdfDiv.DisplayType display) voidsetFloatType(PdfDiv.FloatType floatType) voidvoidvoidsetKeepTogether(boolean keepTogether) voidvoidsetPaddingBottom(float paddingBottom) voidsetPaddingLeft(float paddingLeft) voidsetPaddingRight(float paddingRight) voidsetPaddingTop(float paddingTop) voidsetPercentageHeight(Float percentageHeight) voidsetPercentageWidth(Float percentageWidth) voidsetPosition(PdfDiv.PositionType position) voidvoidSets the role of the accessiblee element.voidsetRunDirection(int runDirection) voidsetSpacingAfter(float spacing) Sets the spacing after this table.voidsetSpacingBefore(float spacing) Sets the spacing before this table.voidsetTextAlignment(int textAlignment) Sets the alignment of this paragraph.voidvoidinttype()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
-
type
-
isContent
public boolean isContent()Description copied from interface:ElementChecks if this element is a content object. If not, it's a metadata object. -
isNestable
public boolean isNestable()Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein 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:
setSpacingBeforein interfaceSpaceable- Parameters:
spacing- the new spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing) Sets the spacing after this table.- Specified by:
setSpacingAfterin interfaceSpaceable- Parameters:
spacing- the new spacing
-
getSpacingBefore
public float getSpacingBefore()Gets the spacing before this table.- Specified by:
getSpacingBeforein interfaceSpaceable- Returns:
- the spacing
-
getSpacingAfter
public float getSpacingAfter()Gets the spacing after this table.- Specified by:
getSpacingAfterin 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:
getPaddingTopin interfaceSpaceable
-
setPaddingTop
public void setPaddingTop(float paddingTop) - Specified by:
setPaddingTopin 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:IAccessibleElementGet the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).- Specified by:
getAccessibleAttributein interfaceIAccessibleElement- Parameters:
key-- Returns:
-
setAccessibleAttribute
Description copied from interface:IAccessibleElementSet the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).- Specified by:
setAccessibleAttributein interfaceIAccessibleElement- Parameters:
key-value-
-
getAccessibleAttributes
Description copied from interface:IAccessibleElementGets all the properties of accessible element.- Specified by:
getAccessibleAttributesin interfaceIAccessibleElement- Returns:
-
getRole
Description copied from interface:IAccessibleElementGets the role of the accessible element.- Specified by:
getRolein interfaceIAccessibleElement- Returns:
-
setRole
Description copied from interface:IAccessibleElementSets the role of the accessiblee element. Set role tonullif you don't want to tag this element. Note that all child elements won't also be tagged.- Specified by:
setRolein interfaceIAccessibleElement- Parameters:
role-
-
getId
- Specified by:
getIdin interfaceIAccessibleElement
-
setId
- Specified by:
setIdin interfaceIAccessibleElement
-
isInline
public boolean isInline()- Specified by:
isInlinein interfaceIAccessibleElement
-