Cannot get SpacingAfter to work on image with iTextSharp
Hi I would like to add some extra space after a image in my iTextSharp generated pdf document. But for some reason whatever I try to do it will not prevent my text from wrapping
Example image
As you can see the "to read everyth..." does not indent like the rest
This is the codesnip that should do this:
var brevityBox = iTextSharp.text.Image.GetInstance("http://" + domain + "/ImageGen.ashx?Text=" + brevityScore + "&FontSize=120&&FontStyle=Bold&Font=Calibri&Align=Center&image=/media/images/PDF/BrevityBox.jpg");
brevityBox.ScaleToFit(80f, 220f);
brevityBox.Alignment = Image.TEXTWRAP;
brevityBox.SpacingAfter = 460f;
doc.Add(brevityBox);
Chunk c3 = new Chunk(brevityText, FontFactory.GetFont("Verdana", 12, Font.NORMAL)); ;
Paragraph p3 = new Paragraph();
p3.IndentationLeft = 20;
p3.IndentationRight = 20;
p3.Alignment = Element.ALIGN_LEFT;
p3.Add(c3);
doc.Add(p3);
Just to prove the point the SpacingAfte开发者_JAVA百科r is 460 points.
IndentationRight
works fine
Any ideas?
I believe that iTextSharp is not even using the SpacingAfter property. I modified the method
iTextSharp.text.pdf.PdfDocument.Add(iTextSharp.text.Image image){}
to this:
if (imageEnd < 0 || imageEnd < currentHeight + image.ScaledHeight + diff + image.SpacingAfter)
{
imageEnd = currentHeight + image.ScaledHeight + diff + image.SpacingAfter;
}
From v5.2.1 it was line 2244 in PdfDocument.cs
精彩评论