Reputation: 5545
Is there a way to set the width of all spaces in a Paragraph in iText 7?
So for example when showing the text "Hello world spacetest" I would like to be able to set the space between "Hello" and "world", and the space between "world" and "spacetest" to 3em.
Upvotes: 0
Views: 222
Reputation: 12312
Use Paragraph#setWordSpacing
for that: e.g. p.setWordSpacing(10);
.
Full code sample:
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
Document document = new Document(pdfDocument);
Paragraph p = new Paragraph("Hello world spacetest");
p.setWordSpacing(10);
document.add(p);
document.close();
Visual result:
Upvotes: 1