Reputation: 1001
I'm currently working on a PDF but I am facing issues trying to increase the line-height of a Paragraph
, this is the code that I have now:
var tempTable = new PdfPTable(1);
cell = new PdfPCell(new Paragraph("My Account", GetInformationalTitle()));
cell.Border = Rectangle.NO_BORDER;
tempTable.AddCell(cell);
cell = new PdfPCell(new Paragraph("http://www.google.com/", GetInformationalOblique()));
cell.Border = Rectangle.NO_BORDER;
cell.PaddingBottom = 10f;
tempTable.AddCell(cell);
var para = new Paragraph("Login to 'My Account' to access detailed information about this order. " +
"You can also change your email address, payment settings, print invoices & much more.", GetInformationalContent());
para.SetLeading(0f, 2f);
cell = new PdfPCell(para);
cell.Border = Rectangle.NO_BORDER;
tempTable.AddCell(cell);
As you can see from above, I'm trying to increase the line-height of para
, I've tried para.SetLeading(0f, 2f)
but it is still not increasing the line-height or leading, as it is called.
What could be the problem here?
Upvotes: 3
Views: 4153
Reputation: 77528
You are adding para
in text mode instead of adding it in composite mode. Text mode means that the leading of the PdfPCell
will get preference over the leading defined for the Paragraph
. With composite mode, it's the other way around.
You can fix this with a small change:
cell = new PdfPCell();
cell.addElement(para);
tempTable.AddCell(cell);
Using the addElement()
method makes cell
switch from text mode to composite mode.
Upvotes: 7