com.aspose.pdf.elements
Class TextInfo

java.lang.Object
  extended by com.aspose.pdf.elements.TextInfo
All Implemented Interfaces:
java.lang.Cloneable

public class TextInfo
extends java.lang.Object
implements java.lang.Cloneable

Encapsulates info for a Text paragraph.


Constructor Summary
TextInfo()
          Initializes a new instance of the TextInfo class.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object arg0)
           
 AlignmentType getAlignmentType()
          Gets an alignment type that indicates the text alignment mode when showed in box.
 Color getBackGroundColor()
          Gets the background color of the text paragraph.
 float getBaseLineOffset()
          Gets the text offset relative to the baseline.
 float getCharSpacing()
          Gets a float value that indicates space between charcters.The unit is point.
 java.lang.String getFontAfmFile()
          Gets a string that indicates the name of custom AFM font file.
 java.lang.String getFontEncoding()
          Gets a string that indicates the font encoding name.
 java.lang.String getFontEncodingFile()
          Gets a string that indicates the name of font encoding file.
 java.lang.String getFontName()
          Gets a string that indicates the text font name.
 java.lang.String getFontOutlineFile()
          Gets a string that indicates the name of custom font outline file.
 java.lang.String getFontPfmFile()
          Gets a string that indicates the name of custom PFM font file.
 float getFontSize()
          Gets a float number that indicates the size of font.
 float getLineSpacing()
          Gets float value that indicates the spacing between two text lines.
The unit is point.
 RenderingMode getRenderingMode()
          Gets an int value between 0 and 7 that indicates the rendering mode of the text.
 Color getTextColor()
          Gets a Color object that indicates the color of the text.
 java.lang.String getTrueTypeFontFileName()
          Gets a string that indicates the truetype font file name.
 float getWordSpacing()
          Gets a float value that indicates space between words.The unit is point.
 boolean isFontEmbedded()
          Gets a bool value that indicates if the font is embedded.
 boolean isStrikeOut()
          Gets a bool value that indicates whether the text is with strikeout.
 boolean isTrueTypeBold()
          Gets a bool value that indicates whether the TrueType font is bold.
 boolean isTrueTypeItalic()
          Gets a bool value that indicates whether the TrueType font is italic.
 boolean isUnderLine()
          Gets a bool value that indicates whether the text is with underline.
 boolean isUnicode()
          Gets a bool value that indicates whether unicode is used.
 TextInfo setAlignmentType(AlignmentType alignmentType)
          Sets a alignment type that indicates the text alignment mode when showed in box.
 TextInfo setBackGroundColor(Color groundColor)
          Sets the background color of the text paragraph.
 TextInfo setBaseLineOffset(float offset)
          Sets the text offset relative to the baseline.
 TextInfo setCharSpacing(float spacing)
          Sets a float value that indicates space between charcters.The unit is point.
 TextInfo setFontAfmFile(java.lang.String afmFile)
          Sets a string that indicates the name of custom AFM font file.
 TextInfo setFontEncoding(java.lang.String encoding)
          Sets a string that indicates the font encoding name.
 TextInfo setFontEncodingFile(java.lang.String encodingFile)
          Sets a string that indicates the name of font encoding file.
 TextInfo setFontName(java.lang.String name)
          Sets a string that indicates the text font name.
 TextInfo setFontOutlineFile(java.lang.String outlineFile)
          Sets a string that indicates the name of custom font outline file.
 TextInfo setFontPfmFile(java.lang.String pfmFile)
          Sets a string that indicates the name of custom PFM font file.
 TextInfo setFontSize(float fontSize)
          Sets a float number that indicates the size of font.
 TextInfo setIsFontEmbedded(boolean fontEmbedded)
          Sets a bool value that indicates if the font is embedded.
 TextInfo setIsUnicode(boolean isUnicode)
          Sets a bool value that indicates whether unicode is used.
 TextInfo setLineSpacing(float spacing)
          Sets a float value that indicates the spacing between two text lines.
The unit is point.
 TextInfo setRenderingMode(RenderingMode mode)
          Sets an int value between 0 and 7 that indicates the rendering mode of the text.
 TextInfo setStrikeOut(boolean strikeOut)
          Sets a bool value that indicates whether the text is with strikeout.
 TextInfo setTextColor(Color color)
          Sets a Color object that indicates the color of the text.
 TextInfo setTrueTypeBold(boolean bold)
          Sets a bool value that indicates whether the TrueType font is bold.
 TextInfo setTrueTypeFontFileName(java.lang.String fontFileName)
          Sets a string that indicates the truetype font file name.
 TextInfo setTrueTypeItalic(boolean italic)
          Sets a bool value that indicates whether the TrueType font is italic.
 TextInfo setUnderLine(boolean underLine)
          Sets a bool value that indicates whether the text is with underline.
 TextInfo setWordSpacing(float spacing)
          Sets a float value that indicates space between words.The unit is point.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextInfo

public TextInfo()
Initializes a new instance of the TextInfo class.

 [SampleCode]
 Section sec1 = pdf.getSections().add();
 Text text1 = new Text(sec1);
 sec1.getParagraphs().add(text1);
 text1.getTextInfo().setTextColor(Color.Red);
 Segment seg1 = new Segment(text1,"seg1 ");
 text1.getSegments().add(seg1);
 Segment seg2 = new Segment(text1,"seg2 ");
 seg2.getTextInfo().setTextColor(Color.Green);
 text1.getSegments().add(seg2);
 

Method Detail

getBaseLineOffset

public float getBaseLineOffset()
Gets the text offset relative to the baseline.


setBaseLineOffset

public TextInfo setBaseLineOffset(float offset)
Sets the text offset relative to the baseline. Positive values rise the text, negative values lower the text. Correspond to TextInfo.IsBaseLine in .net version

Parameters:
offset - the offset you want to set

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

getAlignmentType

public AlignmentType getAlignmentType()
Gets an alignment type that indicates the text alignment mode when showed in box.


setAlignmentType

public TextInfo setAlignmentType(AlignmentType alignmentType)
Sets a alignment type that indicates the text alignment mode when showed in box.


getFontSize

public float getFontSize()
Gets a float number that indicates the size of font. Unit is point. Default is 12.

Returns:
Returns the FontSize.

setFontSize

public TextInfo setFontSize(float fontSize)
Sets a float number that indicates the size of font. Unit is point. Default is 12.

Parameters:
fontSize - The FontSize to set.

getBackGroundColor

public Color getBackGroundColor()
Gets the background color of the text paragraph.


setBackGroundColor

public TextInfo setBackGroundColor(Color groundColor)
Sets the background color of the text paragraph.

Throws:
AsposeBaseException

getTextColor

public Color getTextColor()
Gets a Color object that indicates the color of the text.


setTextColor

public TextInfo setTextColor(Color color)
Sets a Color object that indicates the color of the text.


isTrueTypeBold

public boolean isTrueTypeBold()
Gets a bool value that indicates whether the TrueType font is bold.


setTrueTypeBold

public TextInfo setTrueTypeBold(boolean bold)
Sets a bool value that indicates whether the TrueType font is bold.

Parameters:
bold - boolean, true to set text bold and false not

isTrueTypeItalic

public boolean isTrueTypeItalic()
Gets a bool value that indicates whether the TrueType font is italic.


setTrueTypeItalic

public TextInfo setTrueTypeItalic(boolean italic)
Sets a bool value that indicates whether the TrueType font is italic.

Parameters:
italic - boolean, true to set text italic and false not

isStrikeOut

public boolean isStrikeOut()
Gets a bool value that indicates whether the text is with strikeout.


setStrikeOut

public TextInfo setStrikeOut(boolean strikeOut)
Sets a bool value that indicates whether the text is with strikeout. Limitations: you can only use one of overline, underline, strikeout.


isUnderLine

public boolean isUnderLine()
Gets a bool value that indicates whether the text is with underline. Limitations: you can only use one of overline, underline, strikeout.


setUnderLine

public TextInfo setUnderLine(boolean underLine)
Sets a bool value that indicates whether the text is with underline.


isUnicode

public boolean isUnicode()
Gets a bool value that indicates whether unicode is used.

Returns:
Returns the IsUnicode.

setIsUnicode

public TextInfo setIsUnicode(boolean isUnicode)
Sets a bool value that indicates whether unicode is used.

Parameters:
isUnicode - The IsUnicode to set.

getLineSpacing

public float getLineSpacing()
Gets float value that indicates the spacing between two text lines.
The unit is point.


setLineSpacing

public TextInfo setLineSpacing(float spacing)
Sets a float value that indicates the spacing between two text lines.
The unit is point.


getCharSpacing

public float getCharSpacing()
Gets a float value that indicates space between charcters.The unit is point.


setCharSpacing

public TextInfo setCharSpacing(float spacing)
Sets a float value that indicates space between charcters.The unit is point.


equals

public boolean equals(java.lang.Object arg0)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getWordSpacing

public float getWordSpacing()
Gets a float value that indicates space between words.The unit is point.


setWordSpacing

public TextInfo setWordSpacing(float spacing)
Sets a float value that indicates space between words.The unit is point.


getFontAfmFile

public java.lang.String getFontAfmFile()
Gets a string that indicates the name of custom AFM font file.

Returns:
Returns the FontAfmFile.

setFontAfmFile

public TextInfo setFontAfmFile(java.lang.String afmFile)
Sets a string that indicates the name of custom AFM font file.

Parameters:
afmFile - The FontAfmFile to set.

getFontEncoding

public java.lang.String getFontEncoding()
Gets a string that indicates the font encoding name. For 8-bit fonts,
encoding should be "builtin"(Original encoding used by non-text or non-Latin text fonts) ,
or "winansi"(Windows code page 1252), or the name of an external encoding("cp1251" for example).
The default value is "winansi".

Returns:
Returns the m_fontEncoding.

setFontEncoding

public TextInfo setFontEncoding(java.lang.String encoding)
Sets a string that indicates the font encoding name. For 8-bit fonts,
encoding should be "builtin"(Original encoding used by non-text or non-Latin text fonts) ,
or "winansi"(Windows code page 1252), or the name of an external encoding("cp1251" for example).
The default value is "winansi".

Parameters:
encoding - The FontEncoding to set.

getFontEncodingFile

public java.lang.String getFontEncodingFile()
Gets a string that indicates the name of font encoding file. Font encoding files are
available at http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/ and
http://www.unicode.org/Public/MAPPINGS/ISO8859/.The font encoding name is same as the
encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';
the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.

Returns:
Returns the FontEncodingFile.

setFontEncodingFile

public TextInfo setFontEncodingFile(java.lang.String encodingFile)
Sets a string that indicates the name of font encoding file. Font encoding files are
available at http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/ and
http://www.unicode.org/Public/MAPPINGS/ISO8859/.The font encoding name is same as the
encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';
the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.

Parameters:
encodingFile - The FontEncodingFile to set.

getFontName

public java.lang.String getFontName()
Gets a string that indicates the text font name. Default is Times-Roman.
In Aspose.Pdf,three types of fonts is supported. The first type is base 14 font which are Courier,
Courier-Bold,Courier-BoldOblique,Courier-Oblique,Helvetica,Helvetica-Bold,Helvetica-BoldOblique,
Helvetica-Oblique,Symbol,Times-Bold,Times-BoldItalic,Times-Italic,Times-Roman and ZapfDingbats.
Only font name are needed when using these fonts. The second type is postscript font.
User should set the FontAfmFile or FontPfmFile,FontEncodingFile and FontOutlineFile if want
to embed font. The last type is truetype font. User need to install the truetype font if it is not
installed in the system. Truetype font with unicode is supported. TruetypeFontFileName should be set
when unicode is used. We recommend that you use truetype font instead of postscript font becouse some
type of postscript fonts are not supported.

Returns:
Returns the FontName.

setFontName

public TextInfo setFontName(java.lang.String name)
Sets a string that indicates the text font name. Default is Times-Roman.

Parameters:
name - The FontName to set.

getFontOutlineFile

public java.lang.String getFontOutlineFile()
Gets a string that indicates the name of custom font outline file.
This property is needed when embedding custom PostScript font into PDF files.

Returns:
Returns the FontOutlineFile.

setFontOutlineFile

public TextInfo setFontOutlineFile(java.lang.String outlineFile)
Sets a string that indicates the name of custom font outline file.
This property is needed when embedding custom PostScript font into PDF files.

Parameters:
outlineFile - The FontOutlineFile to set.

getFontPfmFile

public java.lang.String getFontPfmFile()
Gets a string that indicates the name of custom PFM font file.

Returns:
Returns the m_fontPfmFile.

setFontPfmFile

public TextInfo setFontPfmFile(java.lang.String pfmFile)
Sets a string that indicates the name of custom PFM font file.

Parameters:
pfmFile - The FontPfmFile to set.

isFontEmbedded

public boolean isFontEmbedded()
Gets a bool value that indicates if the font is embedded. Default is false.

Returns:
Returns the IsFontEmbedded.

setIsFontEmbedded

public TextInfo setIsFontEmbedded(boolean fontEmbedded)
Sets a bool value that indicates if the font is embedded. Default is false.

Parameters:
fontEmbedded - The IsFontEmbedded to set.

getTrueTypeFontFileName

public java.lang.String getTrueTypeFontFileName()
Gets a string that indicates the truetype font file name. This property is
only needed when using truetype font with unicode. If your truetype font has been
installed in your system, you can use truetype font with unicode without this property.
But using this property will greatly improve the performance.

Returns:
Returns the TruetypeFontFileName.

setTrueTypeFontFileName

public TextInfo setTrueTypeFontFileName(java.lang.String fontFileName)
Sets a string that indicates the truetype font file name. This property is
only needed when using truetype font with unicode. If your truetype font has been
installed in your system, you can use truetype font with unicode without this property.
But using this property will greatly improve the performance.

Parameters:
fontFileName - The TruetypeFontFileName to set.

getRenderingMode

public RenderingMode getRenderingMode()
Gets an int value between 0 and 7 that indicates the rendering mode of the text.

Returns:
Returns the RenderingMode.

setRenderingMode

public TextInfo setRenderingMode(RenderingMode mode)
Sets an int value between 0 and 7 that indicates the rendering mode of the text.

Parameters:
mode - The RenderingMode to set.