aspose.pdf
Class TextInfo

java.lang.Object
  extended by aspose.pdf.TextInfo

public class TextInfo
extends java.lang.Object

Encapsulates info for a Text paragraph.

Typical usages are the following:

Note: The custom PostScript font used in the example is from Jonathan Paterson's Pipe-Dream font.

[Java] Pdf pdf1 = new Pdf(); pdf1.setTruetypeFontDirectoryPath("C:/Windows/Fonts"); Section sec1 = pdf1.getSections().add(); Text text1 = new Text(); text1.getMargin().Top = 30; text1.getTextInfo().setBackgroundColor(new Color("Blue")); sec1.getParagraphs().add(text1); Segment segment1 = text1.getSegments().add("this is text content"); segment1.getTextInfo().setAlignment(AlignmentType.Center); segment1.getTextInfo().setColor(new Color("Red")); segment1.getTextInfo().setOutlineColor(new Color("Blue")); segment1.getTextInfo().setFontSize(16); segment1.getTextInfo().setIsUnicode(true); Text text2 = new Text(); text2.getMargin().Top = 30; sec1.getParagraphs().add(text2); Segment segment2 = text2.getSegments().add("This is TrueType font 'Arial Narrow Bold Italic'."); segment2.getTextInfo().setFontSize(20); segment2.getTextInfo().setFontName("Arial"); segment2.getTextInfo().setIsTrueTypeFontBold(true); segment2.getTextInfo().setIsTrueTypeFontItalic(true); Text text3 = new Text(); text3.getMargin().Top = 30; sec1.getParagraphs().add(text3); Segment segment3 = text3.getSegments().add("CUSTOM PIPE DREAM FONT"); segment3.getTextInfo().setFontSize(20); segment3.getTextInfo().setFontName("Pipe-Dream"); segment3.getTextInfo().setFontAfmFile("E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.AFM"); segment3.getTextInfo().setFontOutlineFile("E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.PFB"); segment3.getTextInfo().setFontEncodingFile("E:/Projects/CSharp/Pdf-bak/fonts/cp1250.txt"); segment3.getTextInfo().setFontEncoding("cp1250"); segment3.getTextInfo().setIsFontEmbeded(true); pdf1.save(....); [XML] <xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section> <Text MarginTop="30" BackgroundColor="Beige"> <Segment Alignment="center" Color="Red" FontSize="16"> this is text content </Segment> </Text> <Text MarginTop="30"> <Segment FontSize="20" FontName="Arial Narrow" IsTrueTypeFontBold="true" IsTrueTypeFontItalic="true"> This is TrueType font 'Arial Narrow Bold Italic'. </Segment> </Text> <Text MarginTop="30"> <Segment FontSize="20" FontName="Pipe-Dream" FontEncoding="cp1250" IsFontEmbedded="true" FontAfmFile="E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.AFM" FontOutlineFile="E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.PFB" FontEncodingFile="E:/Projects/CSharp/Pdf-bak/fonts/cp1250.txt"> CUSTOM PIPE DREAM FONT </Segment> </Text> </Section> </Pdf>


Constructor Summary
TextInfo()
          Initializes a new instance of the TextInfo class
 
Method Summary
 java.lang.Object clone()
          Clone a new TextInfo object.
 AlignmentType getAlignment()
          Gets a AlignmentType that indicates the text alignment mode.
 Color getBackgroundColor()
          Gets the background color of the text paragraph.
 float getCharSpace()
          Gets a float value that indicates space between characters.The unit is point.
 Color getColor()
          Gets a Color object that indicates the color of the text.
 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()
          get 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.
 boolean getIsBaseline()
          Gets a bool value that indicates whether the text is baseline.
 boolean getIsCapRoman()
          Gets a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase.
 boolean getIsFontEmbeded()
          Gets a bool value that indicates if the font is embedded.
 boolean getIsHyperlink()
          Get a boolean value indicates whether it is a hyper link .
 boolean getIsOverline()
          Gets a bool value that indicates whether the text is with overline.
 boolean getIsRightToLeft()
          Gets a bool value that indicates whether the text is right-to-left aligned.
 boolean getIsRoman()
          Gets a bool value that indicates whether Roman number is used.
 boolean getIsStrikeOut()
          Gets a bool value that indicates whether the text is with strikeout.
 boolean getIsSubscript()
          Judge a particular segment Whether it is a Suberscript Field or not
 boolean getIsSuperscript()
          Judge a particular segment Whether it is a Superscript Field or not
 boolean getIsTrueTypeFontBold()
          Gets a bool value that indicates whether the TrueType font is bold.
 boolean getIsTrueTypeFontItalic()
          Gets a bool value that indicates whether the TrueType font is italic.
 boolean getIsUnderline()
          Gets a bool value that indicates whether the text is with underline.
 boolean getIsUnicode()
          Gets a bool value that indicates whether unicode is used.
 float getLineSpacing()
          Gets a float value that indicates the spacing between two text lines.The unit is point.
 Color getOutlineColor()
          Gets a Color object that indicates outline color of the text.
 float getOutlineWidth()
           
 Text getPointText()
          Get the point text object included in the text .
 RenderingMode getRenderingMode()
          Gets an RenderingMode object that indicates the rendering mode of the text.
 BorderInfo getTextBorder()
          Gets a BorderInfo object that indicates the text border.
 java.lang.String getTruetypeFontFileName()
          Gets a string that indicates the truetype font file name.
 float getWordSpace()
          Gets a float value that indicates space between words.The unit is point.
 boolean isSame(TextInfo info)
          Compare with a TextInfo object to see if they are the same .
 void setAlignment(AlignmentType textAlign)
          Sets a AlignmentType that indicates the text alignment mode.
 void setBackgroundColor(Color bgColor)
          Sets the background color of the text paragraph.
 void setCharSpace(float textCharSpace)
          Sets a float value that indicates space between characters.The unit is point.
 void setColor(Color textColor)
          Set a Color object that indicates the color of the text.
 void setFontAfmFile(java.lang.String fontAfm)
          Sets a string that indicates the name of custom AFM font file.
 void setFontEncoding(java.lang.String fontEnc)
          Sets a string that indicates the font encoding name.
 void setFontEncodingFile(java.lang.String fontEncoding)
          Set a string that indicates the name of font encoding file.
 void setFontName(java.lang.String textFontName)
          set a String that indicates the text font name.
 void setFontOutlineFile(java.lang.String fontOutline)
          Sets a string that indicates the name of custom font outline file.
 void setFontPfmFile(java.lang.String fontPfm)
          Sets a string that indicates the name of custom PFM font file.
 void setFontSize(float textFontSize)
          Set a float number that indicates the size of font.
 void setIsBaseline(boolean isTextBaseline)
          Sets a bool value that indicates whether the text is baseline.
 void setIsCapRoman(boolean isCapRoman)
          Sets a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase.
 void setIsFontEmbeded(boolean textIsFontEmbeded)
          Sets a bool value that indicates if the font is embedded.
 void setIsHyperlink(boolean isHyperlink)
          Set a boolean value indicates whether it is a hyper link .
 void setIsOverline(boolean overline)
          Sets a bool value that indicates whether the text is with overline.
 void setIsRightToLeft(boolean isReversed)
          Sets a bool value that indicates whether the text is right-to-left aligned.
 void setIsRoman(boolean isRoman)
          Sets a bool value that indicates whether Roman number is used.
 void setIsStrikeOut(boolean strikeOut)
          Set a bool value that indicates whether the text is with strikeout.
 void setIsSubscript(boolean isSubscript)
          Judge a particular segment Whether it is a Suberscript Field or not
 void setIsSuperscript(boolean isSuperscript)
          Judge a particular segment Whether it is a Superscript Field or not
 void setIsTrueTypeFontBold(boolean isTrueTypeBold)
          Sets a bool value that indicates whether the TrueType font is bold.
 void setIsTrueTypeFontItalic(boolean isTrueTypeItalic)
          Sets a bool value that indicates whether the TrueType font is italic.
 void setIsUnderline(boolean underline)
          Sets a bool value that indicates whether the text is with underline.
 void setIsUnicode(boolean isUnicode)
          Sets a bool value that indicates whether unicode is used.
 void setLineSpacing(float textLineSpace)
          Sets a float value that indicates the spacing between two text lines.The unit is point.
 void setOutlineColor(Color outlineColor)
          Set a Color object that indicates outline color of the text.
 void setOutlineWidth(float outlineWidth)
           
 void setPointText(Text PointText)
          Set the point text object included in the text .
 void setRenderingMode(RenderingMode renderingMode)
          Sets an RenderingMode object that indicates the rendering mode of the text.
 void setTextBorder(BorderInfo textBorder)
          Sets a BorderInfo object that indicates the text border.
 void setTruetypeFontFileName(java.lang.String truetypeFontFile)
          Sets a string that indicates the truetype font file name.
 void setWordSpace(float textWordSpace)
          Sets a float value that indicates space between words.The unit is point.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextInfo

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

Method Detail

getFontName

public java.lang.String getFontName()
get a String that indicates the text font name. Default is Times-Roman

Remarks: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.


setFontName

public void setFontName(java.lang.String textFontName)
set a String that indicates the text font name. Default is Times-Roman

Parameters:
textFontName -

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".


setFontEncoding

public void setFontEncoding(java.lang.String fontEnc)
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:
fontEnc -

getIsUnicode

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


setIsUnicode

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

Parameters:
isUnicode -

getIsFontEmbeded

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


setIsFontEmbeded

public void setIsFontEmbeded(boolean textIsFontEmbeded)
Sets a bool value that indicates if the font is embedded. Default is false.

Parameters:
textIsFontEmbeded -

getFontSize

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


setFontSize

public void setFontSize(float textFontSize)
Set a float number that indicates the size of font.

Parameters:
textFontSize - the value of the font size

getIsTrueTypeFontBold

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

Remarks: Valid for TrueType fonts only.


setIsTrueTypeFontBold

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

Remarks: Valid for TrueType fonts only.

Parameters:
isTrueTypeBold -

getIsTrueTypeFontItalic

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

Remarks: Valid for TrueType fonts only.


setIsTrueTypeFontItalic

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

Remarks: Valid for TrueType fonts only.

Parameters:
isTrueTypeItalic -

getFontAfmFile

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

Remarks: Valid for custom PostScript fonts only. You need to assign either FontAfmFile or FontPfmFile If both are assigned FontAfmFile will be evaluated first.


setFontAfmFile

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

Remarks: Valid for custom PostScript fonts only. You need to assign either FontAfmFile or FontPfmFile If both are assigned FontAfmFile will be evaluated first.

Parameters:
fontAfm -

getFontPfmFile

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

Remarks:Valid for custom PostScript fonts only. You need to assign either FontAfmFile or FontPfmFile. If both are assigned FontAfmFile will be evaluated first.


setFontPfmFile

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

Remarks:Valid for custom PostScript fonts only. You need to assign either FontAfmFile or FontPfmFile. If both are assigned FontAfmFile will be evaluated first.

Parameters:
fontPfm -

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.

Remarks: Valid for custom PostScript fonts only.


setFontOutlineFile

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

Remarks: Valid for custom PostScript fonts only.

Parameters:
fontOutline -

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'.

Remarks: Valid for custom PostScript fonts only.


setFontEncodingFile

public void setFontEncodingFile(java.lang.String fontEncoding)
Set a string that indicates the name of font encoding file.

Parameters:
fontEncoding - the name of encoding file

getIsBaseline

public boolean getIsBaseline()
Gets a bool value that indicates whether the text is baseline. Default is true.


setIsBaseline

public void setIsBaseline(boolean isTextBaseline)
Sets a bool value that indicates whether the text is baseline. Default is true.

Parameters:
isTextBaseline -

getAlignment

public AlignmentType getAlignment()
Gets a AlignmentType that indicates the text alignment mode. This property should be set for the Text object but not Segment object.


setAlignment

public void setAlignment(AlignmentType textAlign)
Sets a AlignmentType that indicates the text alignment mode. This property should be set for the Text object but not Segment object.

Parameters:
textAlign -

getIsUnderline

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


setIsUnderline

public void setIsUnderline(boolean underline)
Sets a bool value that indicates whether the text is with underline.

Parameters:
underline -

getIsOverline

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


setIsOverline

public void setIsOverline(boolean overline)
Sets a bool value that indicates whether the text is with overline.

Parameters:
overline -

getIsStrikeOut

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


setIsStrikeOut

public void setIsStrikeOut(boolean strikeOut)
Set a bool value that indicates whether the text is with strikeout.

Parameters:
strikeOut - true or false

getCharSpace

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


setCharSpace

public void setCharSpace(float textCharSpace)
Sets a float value that indicates space between characters.The unit is point.

Parameters:
textCharSpace -

getWordSpace

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


setWordSpace

public void setWordSpace(float textWordSpace)
Sets a float value that indicates space between words.The unit is point.

Parameters:
textWordSpace -

getRenderingMode

public RenderingMode getRenderingMode()
Gets an RenderingMode object that indicates the rendering mode of the text.


setRenderingMode

public void setRenderingMode(RenderingMode renderingMode)
Sets an RenderingMode object that indicates the rendering mode of the text.

Parameters:
renderingMode -

getColor

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


setColor

public void setColor(Color textColor)
Set a Color object that indicates the color of the text.

Parameters:
textColor - the color object to be used

getOutlineColor

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


setOutlineColor

public void setOutlineColor(Color outlineColor)
Set a Color object that indicates outline color of the text.

Parameters:
outlineColor - the color object to be used

getOutlineWidth

public float getOutlineWidth()

setOutlineWidth

public void setOutlineWidth(float outlineWidth)

getBackgroundColor

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


setBackgroundColor

public void setBackgroundColor(Color bgColor)
Sets the background color of the text paragraph.

Parameters:
bgColor -

getLineSpacing

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


setLineSpacing

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

Parameters:
textLineSpace -

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.


setTruetypeFontFileName

public void setTruetypeFontFileName(java.lang.String truetypeFontFile)
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:
truetypeFontFile -

getTextBorder

public BorderInfo getTextBorder()
Gets a BorderInfo object that indicates the text border. This property should be set to Text object but not segment object.


setTextBorder

public void setTextBorder(BorderInfo textBorder)
Sets a BorderInfo object that indicates the text border. This property should be set to Text object but not segment object.

Parameters:
textBorder -

getIsRightToLeft

public boolean getIsRightToLeft()
Gets a bool value that indicates whether the text is right-to-left aligned. This property is used for right-to-left aligned language such as Arabic and Hebrew.


setIsRightToLeft

public void setIsRightToLeft(boolean isReversed)
Sets a bool value that indicates whether the text is right-to-left aligned. This property is used for right-to-left aligned language such as Arabic and Hebrew.


getIsHyperlink

public boolean getIsHyperlink()
Get a boolean value indicates whether it is a hyper link .


setIsHyperlink

public void setIsHyperlink(boolean isHyperlink)
Set a boolean value indicates whether it is a hyper link .


getIsSuperscript

public boolean getIsSuperscript()
Judge a particular segment Whether it is a Superscript Field or not


setIsSuperscript

public void setIsSuperscript(boolean isSuperscript)
Judge a particular segment Whether it is a Superscript Field or not


getIsSubscript

public boolean getIsSubscript()
Judge a particular segment Whether it is a Suberscript Field or not


setIsSubscript

public void setIsSubscript(boolean isSubscript)
Judge a particular segment Whether it is a Suberscript Field or not


getPointText

public Text getPointText()
Get the point text object included in the text .


setPointText

public void setPointText(Text PointText)
Set the point text object included in the text .


getIsRoman

public boolean getIsRoman()
Gets a bool value that indicates whether Roman number is used. The default value is false which means Arabic number.


setIsRoman

public void setIsRoman(boolean isRoman)
Sets a bool value that indicates whether Roman number is used. The default value is false which means Arabic number.


getIsCapRoman

public boolean getIsCapRoman()
Gets a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase.


setIsCapRoman

public void setIsCapRoman(boolean isCapRoman)
Sets a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase.


clone

public java.lang.Object clone()
Clone a new TextInfo object.

Overrides:
clone in class java.lang.Object
Returns:
The new TextInfo object.

isSame

public boolean isSame(TextInfo info)
Compare with a TextInfo object to see if they are the same .

Parameters:
info - the TextInfo object to be compared
Returns:
true if they are the same and false not the same .