Package com.storedobject.pdf
Class PDFCell
java.lang.Object
com.storedobject.pdf.PDFRectangle
com.storedobject.pdf.PDFCell
- All Implemented Interfaces:
PDFElement
Represents a "cell" of the
PDFTable
. PDFTable
has many methods to create "cells" and
that is the preferred way to create PDFCell
instances rather than directly using the constructors
of this method.- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.pdf.PDFRectangle
BOTTOM, BOX, LEFT, NO_BORDER, RIGHT, TOP, UNDEFINED
Fields inherited from interface com.storedobject.pdf.PDFElement
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, TEXT_DIRECTION_DEFAULT, TEXT_DIRECTION_LTR, TEXT_DIRECTION_NO_BIDI, TEXT_DIRECTION_RTL
-
Constructor Summary
ConstructorsConstructorDescriptionPDFCell()
Constructor.Construct from another cell.Construct from an image as its content.Construct from an image as its content.Constructor from a phrase as its content.Construct from a table as its content.Construct from a table as its content. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(PDFElement element) Add anPDFElement
to this cell.int
Get the number of columns the cell spans.float
Get the extra space between paragraphs.float
Get fixed height for the cell.float
Get the following indent.int
Get the horizontal alignment.getImage()
Get the image contained in this cell.float
Get the indent.float
Get the leading.float
Get the maximum height.float
Get minimum height for the cell.float
Get the variable leading.float
Get the bottom padding of this cell.float
Get the left padding of this cell.float
Get the right padding of this cell.float
Get the top padding of this cell.Get the phrase inside the cell.float
Get the right indent.int
Get the number of rows occupied by this cell.int
Get the text direction.int
Get the vertical alignment.boolean
isWrap()
Does the content wrap in this cell?void
setBackgroundImage
(PDFImage image) Set a background image in this cell (The cell content will go above this image).void
setBackgroundImage
(PDFImage image, boolean scale) Set a background image in this cell (The cell content will go above this image).void
setColumnSpan
(int numbreOfColumns) Set number of columns to span (by default only 1 column of thePDFTable
will be occupied).void
setExtraParagraphSpace
(float extraParagraphSpace) Set the extra space between paragraphs.void
setFixedHeight
(float height) Set fixed height for the cell.void
setFollowingIndent
(float indent) Set the following indent.void
setHorizontalAlignment
(int alignment) Set horizontal alignmentvoid
Set an image as the content of this cell.void
setIndent
(float indent) Set indent.void
setLeading
(float leading) Set the leading to fixed.void
setLeading
(float fixedLeading, float multipliedLeading) Set the leading to fixed and variable part.void
setMinimumHeight
(float height) Set minimum height.void
setPadding
(float padding) Get the padding of this cell.void
setPaddingBottom
(float padding) Set the bottom padding of this cell.void
setPaddingLeft
(float padding) Set padding on the left side.void
setPaddingRight
(float padding) Set padding on the right side.void
setPaddingTop
(float padding) Set padding at the top.void
Set an phrase as the content of this cell.void
setRightIndent
(float indent) Set the right indent.void
setRowSpan
(int rows) Set the number of rows of the table this cell to occupy.void
setTextDirection
(int direction) Set the text direction.void
setVerticalAlignment
(int alignment) Set vertical alignmentvoid
setWrap
(boolean wrap) Set the content to wrap.Methods inherited from class com.storedobject.pdf.PDFRectangle
getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getGrayFill, getHeight, getLeft, getRight, getRotation, getTop, getWidth, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setRotation, setTop
-
Constructor Details
-
PDFCell
public PDFCell()Constructor. -
PDFCell
Constructor from a phrase as its content.- Parameters:
phrase
- Phrase.
-
PDFCell
-
PDFCell
Construct from an image as its content.- Parameters:
image
- Image.autoFit
- Whether to auto-fit it within the cell or not.
-
PDFCell
-
PDFCell
-
PDFCell
-
-
Method Details
-
addElement
Add anPDFElement
to this cell.- Parameters:
element
- Element to add.
-
setMinimumHeight
public void setMinimumHeight(float height) Set minimum height.- Parameters:
height
- Height.
-
setColumnSpan
public void setColumnSpan(int numbreOfColumns) Set number of columns to span (by default only 1 column of thePDFTable
will be occupied).- Parameters:
numbreOfColumns
- Number of columns.
-
setHorizontalAlignment
public void setHorizontalAlignment(int alignment) Set horizontal alignment. (PDFElement.ALIGN_RIGHT
for example).- Parameters:
alignment
- Alignment.
-
setPaddingTop
public void setPaddingTop(float padding) Set padding at the top.- Parameters:
padding
- Padding.
-
setVerticalAlignment
public void setVerticalAlignment(int alignment) Set vertical alignment. (PDFElement.ALIGN_BOTTOM
for example).- Parameters:
alignment
- Alignment.
-
getImage
Get the image contained in this cell.- Returns:
- Image if exists, otherwise
null
.
-
getVerticalAlignment
public int getVerticalAlignment()Get the vertical alignment.- Returns:
- Alignment.
-
setPaddingRight
public void setPaddingRight(float padding) Set padding on the right side.- Parameters:
padding
- Padding.
-
setPaddingLeft
public void setPaddingLeft(float padding) Set padding on the left side.- Parameters:
padding
- Padding.
-
getColumnSpan
public int getColumnSpan()Get the number of columns the cell spans.- Returns:
- Number of columns.
-
getTextDirection
public int getTextDirection()Get the text direction. (Example:PDFElement.TEXT_DIRECTION_RTL
).- Returns:
- Text direction.
-
setTextDirection
public void setTextDirection(int direction) Set the text direction. (Example:PDFElement.TEXT_DIRECTION_RTL
).- Parameters:
direction
- Text direction.
-
getRowSpan
public int getRowSpan()Get the number of rows occupied by this cell.- Returns:
- Number of rows occupied by this cell.
-
setImage
Set an image as the content of this cell.- Parameters:
image
- Image to set.
-
setPhrase
Set an phrase as the content of this cell.- Parameters:
phrase
- Phrase to set.
-
getMaxHeight
public float getMaxHeight()Get the maximum height.- Returns:
- Height.
-
getHorizontalAlignment
public int getHorizontalAlignment()Get the horizontal alignment.- Returns:
- Alignment.
-
setPadding
public void setPadding(float padding) Get the padding of this cell.- Parameters:
padding
- Padding.
-
setLeading
public void setLeading(float leading) Set the leading to fixed.- Parameters:
leading
- Leading.
-
setLeading
public void setLeading(float fixedLeading, float multipliedLeading) Set the leading to fixed and variable part.The resultant leading will be: fixedLeading + multipliedLeading * maxFontSize
where maxFontSize is the size of the biggest font in the line.- Parameters:
fixedLeading
- Fixed leading.multipliedLeading
- Variable part of the leading.
-
getLeading
public float getLeading()Get the leading.- Returns:
- Leading (fixed part).
-
getMultipliedLeading
public float getMultipliedLeading()Get the variable leading.- Returns:
- Leading (variable part).
-
getExtraParagraphSpace
public float getExtraParagraphSpace()Get the extra space between paragraphs.- Returns:
- The extra space between paragraphs.
-
setExtraParagraphSpace
public void setExtraParagraphSpace(float extraParagraphSpace) Set the extra space between paragraphs.- Parameters:
extraParagraphSpace
- The extra space between paragraphs.
-
setIndent
public void setIndent(float indent) Set indent.- Parameters:
indent
- Indent to set.
-
getIndent
public float getIndent()Get the indent.- Returns:
- The indent.
-
setFollowingIndent
public void setFollowingIndent(float indent) Set the following indent.- Parameters:
indent
- Indent to set.
-
getFollowingIndent
public float getFollowingIndent()Get the following indent.- Returns:
- The indent.
-
setRightIndent
public void setRightIndent(float indent) Set the right indent.- Parameters:
indent
- Indent to set.
-
getRightIndent
public float getRightIndent()Get the right indent.- Returns:
- The indent.
-
getPhrase
-
getPaddingLeft
public float getPaddingLeft()Get the left padding of this cell.- Returns:
- Padding.
-
getPaddingRight
public float getPaddingRight()Get the right padding of this cell.- Returns:
- Padding.
-
getPaddingTop
public float getPaddingTop()Get the top padding of this cell.- Returns:
- Padding.
-
getPaddingBottom
public float getPaddingBottom()Get the bottom padding of this cell.- Returns:
- Padding.
-
setPaddingBottom
public void setPaddingBottom(float padding) Set the bottom padding of this cell.- Parameters:
padding
- Padding to set.
-
setFixedHeight
public void setFixedHeight(float height) Set fixed height for the cell.- Parameters:
height
- Height.
-
getFixedHeight
public float getFixedHeight()Get fixed height for the cell.- Returns:
- Height.
-
getMinimumHeight
public float getMinimumHeight()Get minimum height for the cell.- Returns:
- Height.
-
isWrap
public boolean isWrap()Does the content wrap in this cell?- Returns:
- True/false.
-
setWrap
public void setWrap(boolean wrap) Set the content to wrap.- Parameters:
wrap
- True if wrapping to be turned on.
-
setRowSpan
public void setRowSpan(int rows) Set the number of rows of the table this cell to occupy.- Parameters:
rows
- Number of rows.
-
setBackgroundImage
Set a background image in this cell (The cell content will go above this image).- Parameters:
image
- Background image to set.
-
setBackgroundImage
Set a background image in this cell (The cell content will go above this image).- Parameters:
image
- Background image to set.scale
- Whether to scale image to the cell size or not. Iffalse
is passed, it will make sure that the cell has at least the height of the image.
-