Reputation: 13
In my case, I read strings from a data base and then i want to make a PDF with itext5.
The string could be like this: I like oranges and potatoes
If you can see between the words like and oranges there are 3 white spaces.
When i create a paragraph with this text in the resulting PDF i have the next text: I like oranges and potatoes.
The white spaces between like and oranges are lost.
Is it possible to keep up the White spaces?
Thanks!!
Upvotes: 1
Views: 1445
Reputation: 2202
If your white space is in left (" hello")
, the generated pdf will take that whitespace automatically.
for right side ("hello ")
replace white space with "\u00a0"
.
String string="hello ";
string=string.replace(" ","\u00a0");
Upvotes: 4