Cannot draw a PdfTextElement on a smaller rectangle

Hi everyone,

I have a problem when I draw a PdfTextElement on a Rectangle which height is smaller than the text.
It does not throw any error bug but it never exits the drawing function.


It goes like this :
PdfTextElement text = new PdfTextElement();
text.Font = new PdfTrueTypeFont(new Font("Arial", 10.0F, FontStyle.Regular));

textFormat = new PdfStringFormat
{
    Alignment = PdfTextAlignment.Right,
    LineAlignment = PdfVerticalAlignment.Middle,
    WordWrap = PdfWordWrapType.Word
};

text.StringFormat = textFormat;
text.Brush = new PdfSolidBrush(Color.Red);
text.Text = "foo";

RectangleF rect = new RectangleF(5, 5, 20, 5); //where the height is smaller than the text

text.Draw(currentPdfPage, rect, new PdfLayoutFormat { Break = PdfLayoutBreakType.FitPage, Layout = PdfLayoutType.OnePage });

Thanks

PS: I'm on version 15.2451.0.40

1 Reply

SK Sasi Kumar Sekar Syncfusion Team December 22, 2017 01:12 PM UTC

Hi Pierre, 
 
We can able to reproduce the reproduce the reported “hanging issue occurs when drawing text using PdfTextElemet bounds less than the text height”. We have created new incident for this forum under your account, can you please follow up the newly created incident for further updates. 
 
Regards, 
Sasi Kumar S. 


Loader.
Up arrow icon