public class TextInfo extends Object
Encapsulates info for a Text
paragraph. null
<b>Note</b>
: The custom PostScript font used in the example is from Jonathan Paterson's<a href="http://www.mlink.net/~paterson/piped-ps.zip">Pipe-Dream font</a>
.[C#] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.Sections.Add(); Text text1 = new Text(sec1); text1.Margin.Top = 30; text1.TextInfo.BackgroundColor = new Aspose.Pdf.Generator.Color("Beige"); sec1.Paragraphs.Add(text1); Segment segment1 = text1.Segments.Add("this is text content"); segment1.TextInfo.Alignment = AlignmentType.Center; segment1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red"); segment1.TextInfo.FontSize = 16; segment1.TextInfo.IsUnderline = true; //TrueType font example Text text2 = new Text(sec1); text2.Margin.Top = 30; sec1.Paragraphs.Add(text2); Segment segment2 = text2.Segments.Add("This is TrueType font 'Arial Narrow Bold Italic'."); segment2.TextInfo.FontSize = 20; segment2.TextInfo.FontName = "Arial Narrow"; segment2.TextInfo.IsTrueTypeFontBold = true; segment2.TextInfo.IsTrueTypeFontItalic = true; //Embeded custom postscript font example Text text3 = new Text(sec1); text3.Margin.Top = 30; sec1.Paragraphs.Add(text3); Segment segment3 = text3.Segments.Add("CUSTOM PIPE DREAM FONT"); segment3.TextInfo.FontSize = 20; segment3.TextInfo.FontName = "Pipe-Dream"; segment3.TextInfo.FontAfmFile = "E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.AFM"; segment3.TextInfo.FontOutlineFile = "E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.PFB"; segment3.TextInfo.FontEncodingFile = "E:/Projects/CSharp/Pdf-bak/fonts/cp1250.txt"; segment3.TextInfo.FontEncoding = "cp1250"; segment3.TextInfo.IsFontEmbedded = true; pdf1.Save(...); [Visual Basic] Dim pdf1 As Pdf = New Pdf() Dim sec1 As Section = pdf1.Sections.Add() Dim text1 As Text = New Text(sec1) text1.Margin.Top = 30 text1.TextInfo.BackgroundColor = New Aspose.Pdf.Generator.Color("Beige") sec1.Paragraphs.Add(text1) Dim segment1 As Segment = text1.Segments.Add("this is text content") segment1.TextInfo.Alignment = AlignmentType.Center segment1.TextInfo.Color = New Aspose.Pdf.Generator.Color("Red") segment1.TextInfo.FontSize = 16 segment1.TextInfo.IsUnderline = True 'TrueType font example Dim text2 As Text = New Text(sec1) text2.Margin.Top = 30 sec1.Paragraphs.Add(text2) Dim segment2 As Segment = text2.Segments.Add("This is TrueType font 'Arial Narrow Bold Italic'.") segment2.TextInfo.FontSize = 20 segment2.TextInfo.FontName = "Arial Narrow" segment2.TextInfo.IsTrueTypeFontBold = True segment2.TextInfo.IsTrueTypeFontItalic = True 'Embeded custom postscript font example Dim text3 As Text = New Text(sec1) text3.Margin.Top = 30 sec1.Paragraphs.Add(text3) Dim segment3 As Segment = text3.Segments.Add("CUSTOM PIPE DREAM FONT") segment3.TextInfo.FontSize = 20 segment3.TextInfo.FontName = "Pipe-Dream" segment3.TextInfo.FontAfmFile = "E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.AFM" segment3.TextInfo.FontOutlineFile = "E:/Projects/CSharp/Pdf-bak/fonts/PIPED___.PFB" segment3.TextInfo.FontEncodingFile = "E:/Projects/CSharp/Pdf-bak/fonts/cp1250.txt" segment3.TextInfo.FontEncoding = "cp1250" segment3.TextInfo.IsFontEmbedded = 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>
Modifier and Type | Class and Description |
---|---|
static class |
TextInfo.FontWeightSize |
Modifier and Type | Field and Description |
---|---|
boolean |
alignmentChanged |
boolean |
backgroundColorChanged |
boolean |
charSpaceChanged |
boolean |
colorChanged |
boolean |
fontAfmFileChanged |
boolean |
fontEncodingChanged |
boolean |
fontEncodingFileChanged |
boolean |
fontNameChanged |
boolean |
fontOutlineFileChanged |
boolean |
fontPfmFileChanged |
boolean |
fontSizeChanged |
boolean |
isBaselineChanged |
boolean |
isCapRomanChanged |
boolean |
isTrueTypeFontBoldChanged |
boolean |
isTrueTypeFontItalicChanged |
boolean |
lineSpacingChanged |
com.aspose.ms.System.Collections.Hashtable |
privateTextInfo |
boolean |
renderingModeChanged |
boolean |
strokeColorChanged |
boolean |
strokeWidthChanged |
boolean |
textBorderChanged |
boolean |
truetypeFontFileNameChanged |
boolean |
underlineOffsetChanged |
boolean |
wordSpaceChanged |
Constructor and Description |
---|
TextInfo()
Initializes a new instance of the
TextInfo class. |
Modifier and Type | Method and Description |
---|---|
TextInfo |
completeClone() |
Object |
deepClone()
Clone a new
TextInfo object. |
int |
getAlignment()
Gets or sets a
AlignmentType that indicates the text
alignment mode. |
Color |
getBackgroundColor()
Gets or sets the background color of the text paragraph.
|
float |
getCharSpace()
Indicates space between characters.
|
int |
getClear() |
Color |
getColor()
Indicates the color of the text.
|
Color |
getFirstLetterColor()
Gets or sets the background color of the first letter in paragraph.
|
Color |
getFirstLineColor()
Gets or sets the background color of the text paragraph.
|
String |
getFontAfmFile()
The name of custom AFM font file.
|
String |
getFontEncoding()
Indicates the font encoding name.
|
String |
getFontEncodingFile()
The name of custom font encoding file.
|
String |
getFontName()
Indicates the text font name.
|
String |
getFontOutlineFile()
The name of custom font outline file.
|
String |
getFontPfmFile()
The name of custom PFM font file.
|
float |
getFontSize()
Indicates the font encoding name.
|
String |
getFontStretch() |
String |
getFontWeight() |
float |
getLineSpacing()
The space between two text lines.
|
float |
getOverlineOffset()
Gets or sets a float value that indicates the offset of the overline.
|
int |
getRenderingMode()
Indicates the rendering mode of the text.
|
Color |
getStrokeColor()
Gets or sets the stroke color of the text paragraph.
|
float |
getStrokeWidth()
Gets or sets a float number that indicates the width of the stroke.
|
BorderInfo |
getTextBorder()
Gets or sets a
BorderInfo object that indicates the text
border. |
String |
getTruetypeFontFileName() |
float |
getUnderlineOffset()
Gets or sets a float value that indicates the offset of the
underline.
|
float |
getWordSpace()
Indicates space between words.
|
boolean |
isBaseline()
Indicates whether the text is baseline.
|
void |
isBaseline(boolean value) |
boolean |
isCapRoman()
Gets or sets a bool value that indicates the Roman page number is
Capital or lowercase, the default value is false which means lowercase.
|
void |
isCapRoman(boolean value) |
boolean |
isFontEmbedded()
Indicates the font encoding name.
|
void |
isFontEmbedded(boolean value) |
boolean |
isHyperlink()
判断一个segment是否是某一超链接文本的一部分 Add by Jack Qian in 2005.11.1
|
void |
isHyperlink(boolean value) |
boolean |
isOverline()
Indicates whether the text be showed overline.
|
void |
isOverline(boolean value) |
boolean |
isRightToLeft()
Gets or sets a bool value that indicates whether the text is
right-to-left aligned.
|
void |
isRightToLeft(boolean value) |
boolean |
isRoman()
Gets or sets a bool value that indicates whether Roman number is
used.
|
void |
isRoman(boolean value) |
boolean |
isSame(TextInfo info) |
boolean |
isStrikeOut()
Indicates whether the text be showed strikeout.
|
void |
isStrikeOut(boolean value) |
boolean |
isSubscript() |
void |
isSubscript(boolean value) |
boolean |
isSuperscript() |
void |
isSuperscript(boolean value) |
boolean |
isTrueTypeFontBold()
Whether the TrueType font be bold.
|
void |
isTrueTypeFontBold(boolean value) |
boolean |
isTrueTypeFontItalic()
Whether the TrueType font be italic.
|
void |
isTrueTypeFontItalic(boolean value) |
boolean |
isUnderline()
Indicates whether the text be showed underline.
|
void |
isUnderline(boolean value) |
boolean |
isUnicode() |
void |
isUnicode(boolean value) |
void |
setAlignment(int value) |
void |
setBackgroundColor(Color value) |
void |
setCharSpace(float value) |
void |
setClear(int value) |
void |
setColor(Color value) |
void |
setFirstLetterColor(Color value) |
void |
setFirstLineColor(Color value) |
void |
setFontAfmFile(String value) |
void |
setFontEncoding(String value) |
void |
setFontEncodingFile(String value) |
void |
setFontName(String value) |
void |
setFontOutlineFile(String value) |
void |
setFontPfmFile(String value) |
void |
setFontSize(float value) |
void |
setFontStretch(String value) |
void |
setFontWeight(String value) |
void |
setLineSpacing(float value) |
void |
setOverlineOffset(float value) |
void |
setRenderingMode(int value) |
void |
setStrokeColor(Color value) |
void |
setStrokeWidth(float value) |
void |
setTextBorder(BorderInfo value) |
void |
setTruetypeFontFileName(String value) |
void |
setUnderlineOffset(float value) |
void |
setWordSpace(float value) |
public boolean fontNameChanged
public boolean fontEncodingChanged
public boolean fontSizeChanged
public boolean strokeWidthChanged
public boolean isTrueTypeFontBoldChanged
public boolean isTrueTypeFontItalicChanged
public boolean fontAfmFileChanged
public boolean fontPfmFileChanged
public boolean fontOutlineFileChanged
public boolean fontEncodingFileChanged
public boolean isBaselineChanged
public boolean alignmentChanged
public boolean underlineOffsetChanged
public boolean charSpaceChanged
public boolean wordSpaceChanged
public boolean renderingModeChanged
public boolean colorChanged
public boolean strokeColorChanged
public boolean backgroundColorChanged
public boolean lineSpacingChanged
public boolean truetypeFontFileNameChanged
public boolean textBorderChanged
public boolean isCapRomanChanged
public com.aspose.ms.System.Collections.Hashtable privateTextInfo
public String getFontName()
Indicates the text font name.
Gets or sets a string that indicates the text font name. Default is Times-Roman.
public void setFontName(String value)
public String getFontStretch()
public void setFontStretch(String value)
public String getFontWeight()
public void setFontWeight(String value)
public String getFontEncoding()
Indicates the font encoding name.
Gets or 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".
public void setFontEncoding(String value)
public boolean isUnicode()
Gets or sets a bool value that indicates whether unicode is used.
public void isUnicode(boolean value)
public boolean isFontEmbedded()
Indicates the font encoding name.
Gets or sets a bool value that indicates if the font is embedded. Default is false.
public void isFontEmbedded(boolean value)
public float getFontSize()
Indicates the font encoding name.
Gets or sets a float number that indicates the size of font. Unit is point. Default is 12.
public void setFontSize(float value)
public float getStrokeWidth()
Gets or sets a float number that indicates the width of the stroke.
public void setStrokeWidth(float value)
public boolean isTrueTypeFontBold()
Whether the TrueType font be bold.
Gets or sets a bool value that indicates whether the TrueType font is bold.
public void isTrueTypeFontBold(boolean value)
public boolean isTrueTypeFontItalic()
Whether the TrueType font be italic.
Gets or sets a bool value that indicates whether the TrueType font is italic.
public void isTrueTypeFontItalic(boolean value)
public String getFontAfmFile()
The name of custom AFM font file.
Gets or sets a string that indicates the name of custom AFM font file.
FontAfmFile
or
FontPfmFile
. If both are assigned FontAfmFile
will be
evaluated first. public void setFontAfmFile(String value)
public String getFontPfmFile()
The name of custom PFM font file.
Gets or sets a string that indicates the name of custom PFM font file.
FontAfmFile
or
FontPfmFile
. If both are assigned FontAfmFile
will be
evaluated first. public void setFontPfmFile(String value)
public String getFontOutlineFile()
The name of custom font outline file.
Gets or sets a string that indicates the name of custom font outline file. This property is needed when embedding custom PostScript font into PDF files.
<b>Valid for custom PostScript fonts only.</b>
public void setFontOutlineFile(String value)
public String getFontEncodingFile()
The name of custom font encoding file.
Gets or sets a string
that indicates the name of font encoding file. Font encoding files are
available at
<a href="http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/">http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/</a>
and
<a href="http://www.unicode.org/Public/MAPPINGS/ISO8859/">http://www.unicode.org/Public/MAPPINGS/ISO8859/</a>
.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'.
<b>Valid for custom PostScript fonts only.</b>
public void setFontEncodingFile(String value)
public boolean isBaseline()
Indicates whether the text is baseline.
Gets or sets a bool value that indicates whether the text is baseline. Default is true.
public void isBaseline(boolean value)
public int getAlignment()
Gets or sets a AlignmentType
that indicates the text
alignment mode. This property should be set for the Text object but not
Segment object.
public void setAlignment(int value)
public boolean isUnderline()
Indicates whether the text be showed underline.
Gets or sets a bool value that indicates whether the text is with underline.
public void isUnderline(boolean value)
public float getUnderlineOffset()
Gets or sets a float value that indicates the offset of the underline. Use positive value to move it up and negative to move down.
public void setUnderlineOffset(float value)
public boolean isOverline()
Indicates whether the text be showed overline.
Gets or sets a bool value that indicates whether the text is with overline.
public void isOverline(boolean value)
public float getOverlineOffset()
Gets or sets a float value that indicates the offset of the overline. Use positive value to move it up and negative to move down.
public void setOverlineOffset(float value)
public boolean isStrikeOut()
Indicates whether the text be showed strikeout.
Gets or sets a bool value that indicates whether the text is with strikeout.
public void isStrikeOut(boolean value)
public int getClear()
public void setClear(int value)
public float getCharSpace()
Indicates space between characters.
public void setCharSpace(float value)
public float getWordSpace()
Indicates space between words.
Gets or sets a float value that indicates space between words.The unit is point.
public void setWordSpace(float value)
public int getRenderingMode()
Indicates the rendering mode of the text.
Gets or sets an
RenderingMode
object that indicates the rendering mode of the
text.
public void setRenderingMode(int value)
public Color getColor()
Indicates the color of the text.
Gets or sets a Color
object that indicates the color of the text.
public void setColor(Color value)
public Color getStrokeColor()
Gets or sets the stroke color of the text paragraph.
public void setStrokeColor(Color value)
public Color getFirstLineColor()
Gets or sets the background color of the text paragraph.
public void setFirstLineColor(Color value)
public Color getFirstLetterColor()
Gets or sets the background color of the first letter in paragraph.
public void setFirstLetterColor(Color value)
public Color getBackgroundColor()
Gets or sets the background color of the text paragraph.
public void setBackgroundColor(Color value)
public float getLineSpacing()
The space between two text lines.
Gets or sets a float value that indicates the spacing between two text lines.The unit is point.
public void setLineSpacing(float value)
public String getTruetypeFontFileName()
Gets or 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.
public void setTruetypeFontFileName(String value)
public BorderInfo getTextBorder()
Gets or sets a BorderInfo
object that indicates the text
border. This property should be set to Text object but not segment
object.
public void setTextBorder(BorderInfo value)
public boolean isRightToLeft()
Gets or 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.
public void isRightToLeft(boolean value)
public boolean isHyperlink()
判断一个segment是否是某一超链接文本的一部分 Add by Jack Qian in 2005.11.1
public void isHyperlink(boolean value)
public boolean isSuperscript()
public void isSuperscript(boolean value)
public boolean isSubscript()
public void isSubscript(boolean value)
public boolean isRoman()
Gets or sets a bool value that indicates whether Roman number is used. The default value is false which means Arabic number.
public void isRoman(boolean value)
public boolean isCapRoman()
Gets or sets a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase.
public void isCapRoman(boolean value)
public Object deepClone()
Clone a new TextInfo
object.
TextInfo
object.public TextInfo completeClone()
public boolean isSame(TextInfo info)
Copyright © 2016 Aspose. All Rights Reserved.