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.FormattingOptions.setWrapMode ( TextFormattingOptions.WordWrapMode.ByWords); // append string lines paragraph.apendLine("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);
Modifier and Type | Class and Description |
---|---|
static class |
TextParagraph.TextBackgroundMode
Background mode for TextParagraph
|
Modifier and Type | Field and Description |
---|---|
int |
backgroundMode
background mode for the text paragraph TextBackgroundMode.class
|
boolean |
oldCodeCompatibilityMode |
Constructor and Description |
---|
TextParagraph()
Creates
TextParagraph object. |
Modifier and Type | Method and Description |
---|---|
void |
appendLine(String line)
Appends text line
|
void |
appendLine(String line,
float lineSpacing)
Appends text line.
|
void |
appendLine(String line,
TextState textState)
Appends text line with text state parameters.
|
void |
appendLine(String line,
TextState textState,
float lineSpacing)
Appends text line with text state parameters
|
void |
appendLine(TextFragment line)
Appends text line with text state parameters.
|
void |
appendLine(TextFragment line,
TextState textState)
Appends text line with text state parameters.
|
void |
appendLine(TextFragment line,
TextState textState,
float lineSpacing)
Appends text line with text state parameters
|
void |
beginEdit()
Begins the editing of the TextParagraph.
|
void |
endEdit()
Ends the editing of the TextParagraph.
|
TextFormattingOptions |
getFormattingOptions()
Gets formatting options.
|
int |
getHorizontalAlignment()
Gets or sets horizontal alignment for the text inside paragrph's
|
boolean |
getJustify()
Gets value whether text is justified.
|
MarginInfo |
getMargin()
Gets or sets the padding.
|
Position |
getPosition()
Gets position of the paragraph.
|
Rectangle |
getRectangle()
Gets rectangle of the paragraph.
|
float |
getSubsequentLinesIndent()
Gets or sets subsequent lines indent value.
|
Rectangle |
getTextRectangle()
Gets rectangle of the text placed to the paragraph.
|
void |
setBackgroundColor(Color value)
Sets background color for the text paragraph.
|
void |
setFormattingOptions(TextFormattingOptions value)
Sets formatting options.
|
void |
setHorizontalAlignment(int value) |
void |
setJustify(boolean value)
Sets value whether text is justified.
|
void |
setMargin(MarginInfo value) |
void |
setMatrix(Matrix value)
Sets Rotation of the paragraph.
|
void |
setPosition(Position value)
Sets position of the paragraph.
|
void |
setRectangle(Rectangle value)
Sets rectangle of the paragraph.
|
void |
setSubsequentLinesIndent(float value) |
void |
setVerticalAlignment(int value)
Sets vertical alignment for the text inside paragrph's
Rectangle . |
public boolean oldCodeCompatibilityMode
public int backgroundMode
background mode for the text paragraph TextBackgroundMode.class
public void setBackgroundColor(Color value)
Sets background color for the text paragraph.
public void setVerticalAlignment(int value)
Sets vertical alignment for the text inside paragrph's Rectangle
.
public float getSubsequentLinesIndent()
Gets or sets subsequent lines indent value.
public void setSubsequentLinesIndent(float value)
public boolean getJustify()
Gets value whether text is justified.
public void setJustify(boolean value)
Sets value whether text is justified.
public int getHorizontalAlignment()
public void setHorizontalAlignment(int value)
public TextFormattingOptions getFormattingOptions()
Gets formatting options.
public void setFormattingOptions(TextFormattingOptions value)
Sets formatting options.
public Position getPosition()
Gets position of the paragraph.
public void setPosition(Position value)
Sets position of the paragraph.
public Rectangle getTextRectangle()
public Rectangle getRectangle()
Gets rectangle of the paragraph.
public void setRectangle(Rectangle value)
Sets rectangle of the paragraph.
public MarginInfo getMargin()
public void setMargin(MarginInfo value)
public void beginEdit()
public void endEdit()
public void appendLine(String line)
Appends text line
line
- The new line's text.public void appendLine(String line, float lineSpacing)
Appends text line.
line
- The new line's text.lineSpacing
- Additional spacing (0.0 is default and corresponds to default text line height). The spacing value is added to default line spacing for the particular line, so you may specify 12.0 to get empty row AFTER a text line drawn with 12pt font.public void appendLine(String line, TextState textState)
Appends text line with text state parameters.
line
- The new line's text.textState
- Text state of the new line.public void appendLine(String line, TextState textState, float lineSpacing)
Appends text line with text state parameters
line
- The new line's text.textState
- Text state of the new line.lineSpacing
- Additional spacing (0.0 is default and corresponds to default text line height). The spacing value is added to default line spacing for the particular line, so you may specify 12.0 to get empty row AFTER a text line drawn with 12pt font.public void appendLine(TextFragment line)
line
- The new line's text.public void appendLine(TextFragment line, TextState textState)
line
- The new line's text.textState
- Text state of the new line.public void appendLine(TextFragment line, TextState textState, float lineSpacing)
line
- The new line's text.textState
- Text state of the new line.lineSpacing
- Additional spacing (0.0 is default and corresponds to default text line height).
The spacing value is added to default line spacing for the particular line,
so you may specify 12.0 to get empty row AFTER a text line drawn with 12pt font.public void setMatrix(Matrix value)
Sets Rotation of the paragraph.
Copyright © 2018 Aspose. All Rights Reserved.