Gnostice PDFOne
Pro. Ed. v1.41


com.gnostice.pdfone
Class PdfTextFormatter

java.lang.Object
  extended bycom.gnostice.pdfone.PdfTextFormatter
All Implemented Interfaces:
Cloneable

public class PdfTextFormatter
extends Object
implements Cloneable

This class is used to retrieve and specify settings related to text formatting. A single instance of the class can be associated with multiple PdfPage objects. An object of this class is returned when getTextFormatter method is used on a PdfPage object. Formatting settings specified on the PdfTextFormatter object will affect subsequent calls to writeText method for the page.

The text formatting attributes supported by this class are as follows:

An object of the PdfTextFormatter class has the following settings as default:

Since:
1.0
Version:
1.0

Field Summary
static int CENTER
          Constant to align text to center.
static int HORIZONTAL
           
static int JUSTIFIED
          Constant to align text to both left and right margins.
static int LEFT
          Constant to align text to left margin.
static int LEFT_TO_RIGHT
           
static boolean NO_WRAP
          Constant to prevent text wrapping.
static int RIGHT
          Constant to align text to right margin.
static int RIGHT_TO_LEFT
           
static int VERTICAL
           
static boolean WRAP
          Constant to wrap text.
 
Constructor Summary
PdfTextFormatter()
          Zero-argument default constructor.
 
Method Summary
 Object clone()
           
 int getAlignment()
          Retrieves text alignment.
 double getCharSpacing()
           
 int getDirection()
           
 double getFirstLinePosition()
          Retrieves default position where first line of text is set to be written inside rectangles.
 double getLineSpacing()
           
 double getRise()
           
 double getScaling()
           
 double getWordSpacing()
           
 int getWritingMode()
           
 boolean isJustifyLastLine()
          Retrieves whether last line is aligned to both left and right margins.
 boolean isWrap()
          Retrieves whether text is set to wrap.
 void setAlignment(int alignment)
          Specifies text alignment.
 void setCharSpacing(double charSpacing)
           
 void setDirection(int direction)
           
 void setFirstLinePosition(double firstLinePosition)
          Specifies default position where first line of text should be written inside rectangles.
 void setJustifyLastLine(boolean justifyLastLine)
          Specifies whether last line should be aligned to both left and right margins.
 void setLineSpacing(double lineSpacing)
           
 void setRise(double rise)
           
 void setScaling(double scaling)
           
 void setWordSpacing(double wordSpacing)
           
 void setWrap(boolean wrap)
          Specifies whether text should wrap.
 void setWritingMode(int writingMode)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRAP

public static final boolean WRAP
Constant to wrap text.

See Also:
Constant Field Values

NO_WRAP

public static final boolean NO_WRAP
Constant to prevent text wrapping.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Constant to align text to left margin.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Constant to align text to right margin.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Constant to align text to center.

See Also:
Constant Field Values

JUSTIFIED

public static final int JUSTIFIED
Constant to align text to both left and right margins.

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
See Also:
Constant Field Values

LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT
See Also:
Constant Field Values

RIGHT_TO_LEFT

public static final int RIGHT_TO_LEFT
See Also:
Constant Field Values
Constructor Detail

PdfTextFormatter

public PdfTextFormatter()
Zero-argument default constructor.

Method Detail

clone

public Object clone()

getAlignment

public int getAlignment()
Retrieves text alignment.

Returns:
constant identifying text alignment
Since:
1.0
See Also:
setAlignment(int)
Sample Code
See example.

setAlignment

public void setAlignment(int alignment)
Specifies text alignment.

Parameters:
alignment - constant specifying text alignment
Since:
1.0
See Also:
getAlignment()
Sample Code
See example.

getCharSpacing

public double getCharSpacing()

setCharSpacing

public void setCharSpacing(double charSpacing)

getDirection

public int getDirection()

setDirection

public void setDirection(int direction)

getLineSpacing

public double getLineSpacing()

setLineSpacing

public void setLineSpacing(double lineSpacing)

getRise

public double getRise()

setRise

public void setRise(double rise)

getScaling

public double getScaling()

setScaling

public void setScaling(double scaling)

getWordSpacing

public double getWordSpacing()

setWordSpacing

public void setWordSpacing(double wordSpacing)

isWrap

public boolean isWrap()
Retrieves whether text is set to wrap.

Returns:
constant identifying whether text is set to wrap
Since:
1.0
See Also:
setWrap(boolean)
Sample Code
See example.

setWrap

public void setWrap(boolean wrap)
Specifies whether text should wrap.

Parameters:
wrap - constant specifying whether text needs to wrapped
Since:
1.0
See Also:
isWrap()
Sample Code
See example.

getWritingMode

public int getWritingMode()

setWritingMode

public void setWritingMode(int writingMode)

getFirstLinePosition

public double getFirstLinePosition()
Retrieves default position where first line of text is set to be written inside rectangles.

Returns:
default position inside rectangles where the first line of text is set to begin (Expressed in current measurement unit)
Since:
1.0
See Also:
setFirstLinePosition(double)
Sample Code
See example.

setFirstLinePosition

public void setFirstLinePosition(double firstLinePosition)
Specifies default position where first line of text should be written inside rectangles. firstLinePosition must be less than the total width of the rectangle. Else, the first line defaults to the first position on the second line.

Parameters:
firstLinePosition - default position inside rectangles where the first line of text should begin (Applied in current measurement unit)
Since:
1.0
See Also:
getFirstLinePosition()
Sample Code
See example.

isJustifyLastLine

public boolean isJustifyLastLine()
Retrieves whether last line is aligned to both left and right margins.

Returns:
true if last line is aligned to both left and right margins. false if otherwise.
Since:
1.0
See Also:
setJustifyLastLine(boolean)
Sample Code
See example.

setJustifyLastLine

public void setJustifyLastLine(boolean justifyLastLine)
Specifies whether last line should be aligned to both left and right margins. When text is aligned to both margins, it can suffer from poor readability. When there is not enough text on the last line, words might be written far apart from each other.

Parameters:
justifyLastLine - true aligns last line text to both left and right margins. false defaults the alignment to the left margin.
Since:
1.0
See Also:
isJustifyLastLine()
Sample Code
See example.

Gnostice PDFOne
Pro. Ed. v1.41

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2006 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com