Package com.itextpdf.text.pdf
Class PdfChunk
- java.lang.Object
-
- com.itextpdf.text.pdf.PdfChunk
-
-
Field Summary
Fields Modifier and Type Field Description protected IAccessibleElement
accessibleElement
protected java.util.HashMap<java.lang.String,java.lang.Object>
attributes
Metric attributes.protected BaseFont
baseFont
protected boolean
changeLeading
Indicates if the height and offset of the Image has to be taken into accountprotected java.lang.String
encoding
The encoding.protected com.itextpdf.text.pdf.PdfFont
font
The font for thisPdfChunk
.protected Image
image
The image in thisPdfChunk
, if it has oneprotected float
imageScalePercentage
protected float
leading
The leading that can overrule the existing leading.protected boolean
newlineSplit
true
if the chunk split was cause by a newline.protected java.util.HashMap<java.lang.String,java.lang.Object>
noStroke
Non metric attributes.protected float
offsetX
The offset in the x direction for the imageprotected float
offsetY
The offset in the y direction for the imageprotected SplitCharacter
splitCharacter
static float
UNDERLINE_OFFSET
static float
UNDERLINE_THICKNESS
protected java.lang.String
value
The value of this object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
changeLeading()
float
getImageScalePercentage()
Returns a scalePercentage in case the image needs to be scaled.float
getLeading()
float
getTextRise()
Gets the text displacement relative to the baseline.int
getUnicodeEquivalent(int c)
Gets the Unicode equivalent to a CID.float
getWidthCorrected(float charSpacing, float wordSpacing)
Gets the width of thePdfChunk
taking into account the extra character and word spacing.protected int
getWord(java.lang.String text, int start)
boolean
isNewlineSplit()
Checks if thePdfChunk
split was caused by a newline.static boolean
noPrint(int c)
void
setImageScalePercentage(float imageScalePercentage)
Sets a scale percentage in case the image needs to be scaled.java.lang.String
toString()
float
trimFirstSpace()
float
trimLastSpace()
Trims the last space.
-
-
-
Field Detail
-
value
protected java.lang.String value
The value of this object.
-
encoding
protected java.lang.String encoding
The encoding.
-
font
protected com.itextpdf.text.pdf.PdfFont font
The font for thisPdfChunk
.
-
baseFont
protected BaseFont baseFont
-
splitCharacter
protected SplitCharacter splitCharacter
-
attributes
protected java.util.HashMap<java.lang.String,java.lang.Object> attributes
Metric attributes.This attributes require the measurement of characters widths when rendering such as underline.
-
noStroke
protected java.util.HashMap<java.lang.String,java.lang.Object> noStroke
Non metric attributes.This attributes do not require the measurement of characters widths when rendering such as BaseColor.
-
newlineSplit
protected boolean newlineSplit
true
if the chunk split was cause by a newline.
-
image
protected Image image
The image in thisPdfChunk
, if it has one
-
imageScalePercentage
protected float imageScalePercentage
-
offsetX
protected float offsetX
The offset in the x direction for the image
-
offsetY
protected float offsetY
The offset in the y direction for the image
-
changeLeading
protected boolean changeLeading
Indicates if the height and offset of the Image has to be taken into account
-
leading
protected float leading
The leading that can overrule the existing leading.
-
accessibleElement
protected IAccessibleElement accessibleElement
-
UNDERLINE_THICKNESS
public static final float UNDERLINE_THICKNESS
- See Also:
- Constant Field Values
-
UNDERLINE_OFFSET
public static final float UNDERLINE_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUnicodeEquivalent
public int getUnicodeEquivalent(int c)
Gets the Unicode equivalent to a CID. The (inexistent) CIDis translated as '\n'. It has only meaning with CJK fonts with Identity encoding. - Parameters:
c
- the CID code- Returns:
- the Unicode equivalent
-
getWord
protected int getWord(java.lang.String text, int start)
-
isNewlineSplit
public boolean isNewlineSplit()
Checks if thePdfChunk
split was caused by a newline.- Returns:
true
if thePdfChunk
split was caused by a newline.
-
getWidthCorrected
public float getWidthCorrected(float charSpacing, float wordSpacing)
Gets the width of thePdfChunk
taking into account the extra character and word spacing.- Parameters:
charSpacing
- the extra character spacingwordSpacing
- the extra word spacing- Returns:
- the calculated width
-
getTextRise
public float getTextRise()
Gets the text displacement relative to the baseline.- Returns:
- a displacement in points
-
trimLastSpace
public float trimLastSpace()
Trims the last space.- Returns:
- the width of the space trimmed, otherwise 0
-
trimFirstSpace
public float trimFirstSpace()
-
getImageScalePercentage
public float getImageScalePercentage()
Returns a scalePercentage in case the image needs to be scaled.- Returns:
- the imageScalePercentage
-
setImageScalePercentage
public void setImageScalePercentage(float imageScalePercentage)
Sets a scale percentage in case the image needs to be scaled.- Parameters:
imageScalePercentage
- the imageScalePercentage to set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
changeLeading
public boolean changeLeading()
-
getLeading
public float getLeading()
-
noPrint
public static boolean noPrint(int c)
-
-