Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paragraph leading inside table cell

Tags:

java

itext

I have a table with cells set up like this:

Paragraph p = new Paragraph(content,font); 
p.setLeading(30); 
PdfPCell c = new PdfPCell(p);

My problem is that the paragraph leading is ignored. Can someone please tell me how to set the paragraph leading when inside a table cell? It works perfectly when not inside a cell.

Thanks.

like image 462
Reda Avatar asked Sep 17 '25 21:09

Reda


1 Answers

Google for the difference between "text mode" and "composite mode". You are using "text mode": the leading of the cell is taken into account; the leading of the paragraph is ignored. If you use "composite mode", it's the other way round.

Try:

PdfPCell c = new PdfPCell(); 
c.addElement(p); 
like image 174
Reda Avatar answered Sep 19 '25 12:09

Reda