com.itextpdf.text.pdf
Class PdfDiv

java.lang.Object
  extended by com.itextpdf.text.pdf.PdfDiv
All Implemented Interfaces:
Spaceable, Element, IAccessibleElement

public class PdfDiv
extends Object
implements Element, Spaceable, IAccessibleElement

A special element to put a collection of elements at an absolute position.


Nested Class Summary
static class PdfDiv.FloatType
           
static class PdfDiv.PositionType
           
 
Field Summary
protected  HashMap<PdfName,PdfObject> accessibleAttributes
           
protected  UUID id
           
protected  PdfName role
           
protected  float spacingAfter
          The spacing after the table.
protected  float spacingBefore
          The spacing before the table.
 
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, 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
PdfDiv()
           
 
Method Summary
 void addElement(Element element)
           
 PdfObject getAccessibleAttribute(PdfName key)
          Get the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E).
 HashMap<PdfName,PdfObject> getAccessibleAttributes()
          Gets all the properties of accessible element.
 float getActualHeight()
           
 float getActualWidth()
           
 BaseColor getBackgroundColor()
           
 Float getBottom()
           
 List<Chunk> getChunks()
          Gets all the chunks in this element.
 ArrayList<Element> getContent()
           
 float getContentHeight()
           
 float getContentWidth()
           
 PdfDiv.FloatType getFloatType()
           
 Float getHeight()
           
 UUID getId()
           
 Float getLeft()
           
 float getPaddingBottom()
           
 float getPaddingLeft()
           
 float getPaddingRight()
           
 float getPaddingTop()
           
 Float getPercentageHeight()
           
 Float getPercentageWidth()
           
 PdfDiv.PositionType getPosition()
           
 Float getRight()
           
 PdfName getRole()
          Gets the role of the accessible element.
 float getSpacingAfter()
          Gets the spacing after this table.
 float getSpacingBefore()
          Gets the spacing before this table.
 int getTextAlignment()
          Gets the alignment of this paragraph.
 Float getTop()
           
 Float getWidth()
           
 boolean isContent()
          Checks if this element is a content object.
 boolean isNestable()
          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 an ElementListener.
 void setAccessibleAttribute(PdfName key, PdfObject value)
          Set the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E).
 void setBackgroundColor(BaseColor backgroundColor)
           
 void setBottom(Float bottom)
           
 void setContent(ArrayList<Element> content)
           
 void setContentHeight(float contentHeight)
           
 void setContentWidth(float contentWidth)
           
 void setFloatType(PdfDiv.FloatType floatType)
           
 void setHeight(Float height)
           
 void setId(UUID id)
           
 void setLeft(Float left)
           
 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 setRight(Float right)
           
 void setRole(PdfName role)
          Sets the role of the accessiblee element.
 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 setTop(Float top)
           
 void setWidth(Float width)
           
 int type()
          Gets the type of the text element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itextpdf.text.Element
toString
 

Field Detail

role

protected PdfName role

accessibleAttributes

protected HashMap<PdfName,PdfObject> accessibleAttributes

id

protected UUID id

spacingBefore

protected float spacingBefore
The spacing before the table.


spacingAfter

protected float spacingAfter
The spacing after the table.

Constructor Detail

PdfDiv

public PdfDiv()
Method Detail

getContentWidth

public float getContentWidth()

setContentWidth

public void setContentWidth(float contentWidth)

getContentHeight

public float getContentHeight()

setContentHeight

public void setContentHeight(float contentHeight)

getActualHeight

public float getActualHeight()

getActualWidth

public float getActualWidth()

getPercentageHeight

public Float getPercentageHeight()

setPercentageHeight

public void setPercentageHeight(Float percentageHeight)

getPercentageWidth

public Float getPercentageWidth()

setPercentageWidth

public void setPercentageWidth(Float percentageWidth)

getBackgroundColor

public BaseColor getBackgroundColor()

setBackgroundColor

public void setBackgroundColor(BaseColor backgroundColor)

getChunks

public List<Chunk> getChunks()
Gets all the chunks in this element.

Specified by:
getChunks in interface Element
Returns:
an ArrayList

type

public int type()
Gets the type of the text element.

Specified by:
type in interface Element
Returns:
a type

isContent

public boolean isContent()
Description copied from interface: Element
Checks if this element is a content object. If not, it's a metadata object.

Specified by:
isContent in interface Element
Returns:
true if this is a 'content' element; false if this is a 'metadata' element
Since:
iText 2.0.8
See Also:
Element.isContent()

isNestable

public boolean isNestable()
Description copied from interface: Element
Checks if this element is nestable.

Specified by:
isNestable in interface Element
Returns:
true if this element can be nested inside other elements.
Since:
iText 2.0.8
See Also:
Element.isNestable()

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.

Specified by:
process in interface Element
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

setSpacingBefore

public void setSpacingBefore(float spacing)
Sets the spacing before this table.

Specified by:
setSpacingBefore in interface Spaceable
Parameters:
spacing - the new spacing

setSpacingAfter

public void setSpacingAfter(float spacing)
Sets the spacing after this table.

Specified by:
setSpacingAfter in interface Spaceable
Parameters:
spacing - the new spacing

getSpacingBefore

public float getSpacingBefore()
Gets the spacing before this table.

Specified by:
getSpacingBefore in interface Spaceable
Returns:
the spacing

getSpacingAfter

public float getSpacingAfter()
Gets the spacing after this table.

Specified by:
getSpacingAfter in interface Spaceable
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

public void addElement(Element element)

getLeft

public Float getLeft()

setLeft

public void setLeft(Float left)

getRight

public Float getRight()

setRight

public void setRight(Float right)

getTop

public Float getTop()

setTop

public void setTop(Float top)

getBottom

public Float getBottom()

setBottom

public void setBottom(Float bottom)

getWidth

public Float getWidth()

setWidth

public void setWidth(Float width)

getHeight

public Float getHeight()

setHeight

public void setHeight(Float height)

getPaddingLeft

public float getPaddingLeft()

setPaddingLeft

public void setPaddingLeft(float paddingLeft)

getPaddingRight

public float getPaddingRight()

setPaddingRight

public void setPaddingRight(float paddingRight)

getPaddingTop

public float getPaddingTop()

setPaddingTop

public void setPaddingTop(float paddingTop)

getPaddingBottom

public float getPaddingBottom()

setPaddingBottom

public void setPaddingBottom(float paddingBottom)

getFloatType

public PdfDiv.FloatType getFloatType()

setFloatType

public void setFloatType(PdfDiv.FloatType floatType)

getPosition

public PdfDiv.PositionType getPosition()

setPosition

public void setPosition(PdfDiv.PositionType position)

getContent

public ArrayList<Element> getContent()

setContent

public void setContent(ArrayList<Element> content)

layout

public int layout(PdfContentByte canvas,
                  boolean useAscender,
                  boolean simulate,
                  float llx,
                  float lly,
                  float urx,
                  float ury)
           throws DocumentException
Throws:
DocumentException

getAccessibleAttribute

public PdfObject getAccessibleAttribute(PdfName key)
Description copied from interface: IAccessibleElement
Get the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E).

Specified by:
getAccessibleAttribute in interface IAccessibleElement
Returns:

setAccessibleAttribute

public void setAccessibleAttribute(PdfName key,
                                   PdfObject value)
Description copied from interface: IAccessibleElement
Set the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E).

Specified by:
setAccessibleAttribute in interface IAccessibleElement

getAccessibleAttributes

public HashMap<PdfName,PdfObject> getAccessibleAttributes()
Description copied from interface: IAccessibleElement
Gets all the properties of accessible element.

Specified by:
getAccessibleAttributes in interface IAccessibleElement
Returns:

getRole

public PdfName getRole()
Description copied from interface: IAccessibleElement
Gets the role of the accessible element.

Specified by:
getRole in interface IAccessibleElement
Returns:

setRole

public void setRole(PdfName role)
Description copied from interface: IAccessibleElement
Sets the role of the accessiblee element. Set role to null if you don't want to tag this element. Note that all child elements won't also be tagged.

Specified by:
setRole in interface IAccessibleElement

getId

public UUID getId()
Specified by:
getId in interface IAccessibleElement

setId

public void setId(UUID id)
Specified by:
setId in interface IAccessibleElement


Copyright © 2013. All Rights Reserved.