Raju Khinda
Raju Khinda

Reputation: 105

Itext7 - Place Text at specific position

ColumnText ct = new ColumnText(writer.getDirectContent());
ct.setSimpleColumn(left,bottom,right,top);
ct.setText(new Phrase("String"));
ct.go();

This how we were doing in Itext 5 . But how can we place text on specific position on page . I have multiple text to place on page along with images .

Thanks

Upvotes: 6

Views: 11346

Answers (1)

Bruno Lowagie
Bruno Lowagie

Reputation: 77528

Try this:

Paragraph p = new Paragraph("test");
p.setFixedPosition(100, 800, 200);
document.add(p);

It should be that simple.

In this example, x = 100, y = 800, and 200 is the width.

For an example, see https://developers.itextpdf.com/content/itext-7-building-blocks/examples/chapter-6#2574-c06e08_explicitdestinations.java

Upvotes: 8

Related Questions