Package com.storedobject.pdf
Class PDFChunk
java.lang.Object
com.storedobject.pdf.PDFChunk
-
Field Summary
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend to the text content.float
Get the character spacing.Get the list of chunks within this.getFont()
Set the font.float
Get horizontal scaling.getImage()
Get the image in this chunk.float
Get the text-rise value.boolean
isEmpty()
Is this chunk empty?boolean
Does this contain only "white spaces"?setBackground
(PDFColor color) Set the background colorvoid
setBackground
(PDFColor color, float extraLeft, float extraBottom, float extraRight, float extraTop) Set the background colorvoid
setCharacterSpacing
(float spacing) Set the character spacing.void
Set the font.void
setHorizontalScaling
(float scaling) Set the horizontal scaling.void
setLineHeight
(float height) Set the line height.void
Set to the new page.void
setSkew
(float firstAngle, float secondAngle) Set the skew angles.void
setTextRise
(float rise) Set the text-rise.void
setUnderline
(float thickness, float yPosition) Set thickness for the underline.
-
Constructor Details
-
PDFChunk
public PDFChunk()Constructor. -
PDFChunk
Construct from another chunk.- Parameters:
chunk
- Create from this chunk.
-
PDFChunk
-
PDFChunk
-
PDFChunk
Construct from a given character.- Parameters:
c
- Character to include.font
- Font to use.
-
PDFChunk
public PDFChunk(char c) Construct from a given character.- Parameters:
c
- Character to include.
-
PDFChunk
Construct from a given image.- Parameters:
image
- Image to include.xOffset
- X offset.yOffset
- Y offset.
-
-
Method Details
-
append
Append to the text content.- Parameters:
text
- Text to append.- Returns:
- String builder to chain.
-
isEmpty
public boolean isEmpty()Is this chunk empty?- Returns:
- True/false.
-
isWhitespace
public boolean isWhitespace()Does this contain only "white spaces"?- Returns:
- True/false.
-
getImage
Get the image in this chunk.- Returns:
- Image or
null
if t=it doesn't exist.
-
getChunks
-
setFont
-
setBackground
-
setBackground
public void setBackground(PDFColor color, float extraLeft, float extraBottom, float extraRight, float extraTop) Set the background color- Parameters:
color
- Background to set.extraLeft
- Extra portion on the left.extraBottom
- Extra portion at the bottom.extraRight
- Extra portion on the right.extraTop
- Extra portion at the top.
-
getFont
-
getCharacterSpacing
public float getCharacterSpacing()Get the character spacing.- Returns:
- Character spacing.
-
getHorizontalScaling
public float getHorizontalScaling()Get horizontal scaling.- Returns:
- Horizontal scaling.
-
setCharacterSpacing
public void setCharacterSpacing(float spacing) Set the character spacing.- Parameters:
spacing
- Character spacing to set.
-
setHorizontalScaling
public void setHorizontalScaling(float scaling) Set the horizontal scaling.- Parameters:
scaling
- Horizontal scaling to set.
-
setTextRise
public void setTextRise(float rise) Set the text-rise.- Parameters:
rise
- Rise value for the text.
-
setNewPage
public void setNewPage()Set to the new page. -
setUnderline
public void setUnderline(float thickness, float yPosition) Set thickness for the underline.- Parameters:
thickness
- Thickness.yPosition
- Y position.
-
getTextRise
public float getTextRise()Get the text-rise value.- Returns:
- Text-rise value.
-
setSkew
public void setSkew(float firstAngle, float secondAngle) Set the skew angles.- Parameters:
firstAngle
- First angle.secondAngle
- Second angle.
-
setLineHeight
public void setLineHeight(float height) Set the line height.- Parameters:
height
- Line height.
-