In this example , we are going to explain how we
can set space ratio and how we can gives various alignment. You can make
pdf with no space between the characters of a word .
Code Description:
setAlignment(int
alignment):
We can set the aligment of a Paragraph with the method setAlignment(int alignment). The alignment can be one of the following values:
setSpaceCharRatio:
If you want the alignment to be justified, the space between the words can
be stretched, as well as the space between the characters of a word. The
default ratio of this word-char space is 2.5. You can change this ratio
with setSpaceCharRatio.
For instance, if you don't want the space between the characters of a word
.We can do this by:
writer.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
The code of the program is given below:
import java.io.FileOutputStream;
|
The output of the program is given below:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Set Space Ratio and Alignment
Post your Comment