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

ConstructorDescription
TextParagraphCreates {@code TextParagraph} object.

Methods

MethodDescription
appendLineAppends text line
appendLineAppends text line.
appendLineAppends text line with text state parameters.
appendLineAppends text line with text state parameters
appendLineAppends text line with text state parameters.
appendLineAppends text line with text state parameters.
appendLineAppends text line with text state parameters
beginEditBegins 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.

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

getFirstLineIndentGets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
getFormattingOptionsGets formatting options.
getHorizontalAlignmentGets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left.
getHyphenSymbolGets 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.
getMarginGets the padding.
getPositionGets position of the paragraph.
getRectangleGets rectangle of the paragraph.
getRotationGets or sets rotation angle in degrees.
getSubsequentLinesIndentGets subsequent lines indent value.
getTextRectangleGets rectangle of the text placed to the paragraph.
getVerticalAlignment

Gets vertical alignment for the text inside paragrph’s {@code Rectangle}.

isJustifyGets value whether text is justified.
setBackgroundColorSets background color for the text paragraph.
setBackgroundModeSet background mode for the text paragraph
setFirstLineIndentGets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
setFormattingOptionsSets formatting options.
setHorizontalAlignmentSets horizontal alignment for the text inside paragrph’s Rectangle. HorizontalAlignment.None is equal to HorizontalAlignment.Left.
setHyphenSymbolSets 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.
setJustifySets value whether text is justified.
setMarginSets the padding.
setMatrixSets Rotation of the paragraph.
setOldCodeCompatibilityModeSet old code compatibility mode
setPositionSets position of the paragraph.
setRectangleSets rectangle of the paragraph.
setRotationGets or sets rotation angle in degrees.
setSubsequentLinesIndentSets subsequent lines indent value.
setVerticalAlignmentSets 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:

ParameterTypeDescription
valueint 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:

ParameterTypeDescription
valuefloat 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:

ParameterTypeDescription
valueboolean value

setMargin

Sets the padding.

setMatrix

Sets Rotation of the paragraph.

setOldCodeCompatibilityMode

public void setOldCodeCompatibilityMode(boolean value)

Set old code compatibility mode

Parameters:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
valuedouble value

setSubsequentLinesIndent

public void setSubsequentLinesIndent(float value)

Sets subsequent lines indent value.

Parameters:

ParameterTypeDescription
valuefloat value

setVerticalAlignment

Sets vertical alignment for the text inside paragrph’s {@code Rectangle}. VerticalAlignment.None is equal to VerticalAlignment.Bottom.