TextParagraph
Inheritance: java.lang.Object, com.aspose.pdf.TextParagraph
public final class TextParagraph extends Object
Represents text paragraphs as multiline text object.
The example demonstrates how to create text paragraph object and append it to the Pdf page. Document doc = new Document(inFile); Page page = (Page)doc.getPages().get(1); // create text paragraph TextParagraph paragraph = new TextParagraph(); // set the paragraph rectangle paragraph.setRectangle ( new Rectangle(100, 600, 200, 700)); // set word wrapping options paragraph.getFormattingOptions().setWrapMode ( TextFormattingOptions.WordWrapMode.ByWords); // append string lines paragraph.appendLine("the quick brown fox jumps over the lazy dog"); paragraph.appendLine("line2"); paragraph.appendLine("line3"); // append the paragraph to the Pdf page with the TextBuilder TextBuilder textBuilder = new TextBuilder(page); textBuilder.appendParagraph(paragraph); // save Pdf document doc.save(outFile); Constructors
| Constructor | Description |
|---|---|
| TextParagraph | Creates {@code TextParagraph} object. |
Methods
| Method | Description |
|---|---|
| appendLine | Appends text line |
| appendLine | Appends text line. |
| appendLine | Appends text line with text state parameters. |
| appendLine | Appends text line with text state parameters |
| appendLine | Appends text line with text state parameters. |
| appendLine | Appends text line with text state parameters. |
| appendLine | Appends text line with text state parameters |
| beginEdit | Begins the editing of the TextParagraph. Improves performance of TextParagraph population. Any layout calculation is suspended until EndEdit method is invoked. Note that method invoke can’t be nested. |
| endEdit | Ends the editing of the TextParagraph. Improves performance of TextParagraph population. Any layout calculation is suspended until EndEdit method is invoked. Note that method invoke can’t be nested. |
| getFirstLineIndent | Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value. |
| getFormattingOptions | Gets formatting options. |
| getHorizontalAlignment | Gets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left. |
| getHyphenSymbol | Gets hyphen symbol that is used in hyphenation process. The hyphenation symbol is “-” by default. To eliminate hyphen drawing (with wrapping procedure still in place) please set empty string string.Empty for HyphenSymbol. |
| getMargin | Gets the padding. |
| getPosition | Gets position of the paragraph. |
| getRectangle | Gets rectangle of the paragraph. |
| getRotation | Gets or sets rotation angle in degrees. |
| getSubsequentLinesIndent | Gets subsequent lines indent value. |
| getTextRectangle | Gets rectangle of the text placed to the paragraph. |
| getVerticalAlignment | Gets vertical alignment for the text inside paragrph’s {@code Rectangle}. |
| isJustify | Gets value whether text is justified. |
| setBackgroundColor | Sets background color for the text paragraph. |
| setBackgroundMode | Set background mode for the text paragraph |
| setFirstLineIndent | Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value. |
| setFormattingOptions | Sets formatting options. |
| setHorizontalAlignment | Sets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left. |
| setHyphenSymbol | Sets hyphen symbol that is used in hyphenation process. The hyphenation symbol is “-” by default. To eliminate hyphen drawing (with wrapping procedure still in place) please set empty string string.Empty for HyphenSymbol. |
| setJustify | Sets value whether text is justified. |
| setMargin | Sets the padding. |
| setMatrix | Sets Rotation of the paragraph. |
| setOldCodeCompatibilityMode | Set old code compatibility mode |
| setPosition | Sets position of the paragraph. |
| setRectangle | Sets rectangle of the paragraph. |
| setRotation | Gets or sets rotation angle in degrees. |
| setSubsequentLinesIndent | Sets subsequent lines indent value. |
| setVerticalAlignment | Sets vertical alignment for the text inside paragrph’s {@code Rectangle}. VerticalAlignment.None is equal to VerticalAlignment.Bottom. |
TextParagraph
public TextParagraph()
Creates {@code TextParagraph} object.
appendLine
Appends text line
appendLine
Appends text line.
appendLine
Appends text line with text state parameters.
appendLine
Appends text line with text state parameters
appendLine
Appends text line with text state parameters.
appendLine
Appends text line with text state parameters.
appendLine
Appends text line with text state parameters
beginEdit
public void beginEdit()
Begins the editing of the TextParagraph.
Improves performance of TextParagraph population. Any layout calculation is suspended until EndEdit method is invoked.
Note that method invoke can’t be nested.
endEdit
public void endEdit()
Ends the editing of the TextParagraph.
Improves performance of TextParagraph population. Any layout calculation is suspended until EndEdit method is invoked.
Note that method invoke can’t be nested.
getFirstLineIndent
public final float getFirstLineIndent()
Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
Returns: float value
getFormattingOptions
public TextFormattingOptions getFormattingOptions()
Gets formatting options.
Returns: TextFormattingOptions object
getHorizontalAlignment
public HorizontalAlignment getHorizontalAlignment()
Gets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left.
Returns: HorizontalAlignment value @see HorizontalAlignment
getHyphenSymbol
public String getHyphenSymbol()
Gets hyphen symbol that is used in hyphenation process. The hyphenation symbol is “-” by default. To eliminate hyphen drawing (with wrapping procedure still in place) please set empty string string.Empty for HyphenSymbol.
Returns: String value
getMargin
public MarginInfo getMargin()
Gets the padding.
Returns: MarginInfo value
getPosition
public Position getPosition()
Gets position of the paragraph.
Returns: Position value
getRectangle
public Rectangle getRectangle()
Gets rectangle of the paragraph.
Returns: Rectangle object
getRotation
public double getRotation()
Gets or sets rotation angle in degrees.
Returns: double value
getSubsequentLinesIndent
public float getSubsequentLinesIndent()
Gets subsequent lines indent value.
Returns: float value
getTextRectangle
public Rectangle getTextRectangle()
Gets rectangle of the text placed to the paragraph.
Returns: Rectangle object
getVerticalAlignment
public VerticalAlignment getVerticalAlignment()
Gets vertical alignment for the text inside paragrph's {@code Rectangle}.
Returns: VerticalAlignment value @see VerticalAlignment
VerticalAlignment.None is equal to VerticalAlignment.Bottom.
isJustify
public boolean isJustify()
Gets value whether text is justified.
Returns: boolean value
setBackgroundColor
Sets background color for the text paragraph.
setBackgroundMode
public void setBackgroundMode(int value)
Set background mode for the text paragraph
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int value @see TextBackgroundMode |
setFirstLineIndent
public final void setFirstLineIndent(float value)
Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float value |
setFormattingOptions
Sets formatting options.
setHorizontalAlignment
Sets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left.
setHyphenSymbol
Sets hyphen symbol that is used in hyphenation process. The hyphenation symbol is “-” by default. To eliminate hyphen drawing (with wrapping procedure still in place) please set empty string string.Empty for HyphenSymbol.
setJustify
public void setJustify(boolean value)
Sets value whether text is justified.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setMargin
Sets the padding.
setMatrix
Sets Rotation of the paragraph.
setOldCodeCompatibilityMode
public void setOldCodeCompatibilityMode(boolean value)
Set old code compatibility mode
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setPosition
Sets position of the paragraph.
setRectangle
Sets rectangle of the paragraph.
setRotation
public void setRotation(double value)
Gets or sets rotation angle in degrees.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double value |
setSubsequentLinesIndent
public void setSubsequentLinesIndent(float value)
Sets subsequent lines indent value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float value |
setVerticalAlignment
Sets vertical alignment for the text inside paragrph’s {@code Rectangle}. VerticalAlignment.None is equal to VerticalAlignment.Bottom.