Free Support Forum - aspose.com

Calculate Fontsize to fit in Rectangle

Hi,
I need to create PDF files where the text parts fit into certain rectangular areas… Thus I need to calculate the maximum fontsize which fits into an area and I need to calculate the exact height the text will be for a certain width + fontsize.

It seems that there is a method MeasureString but this only gives the width.

How do I achieve the above goal?
Thanks in advance.

Best Regards
Yahia

@it-yeq

Yes, your understanding is correct. The MeasureString Method gives only width. However, could you please share your sample source PDF and expected output. We will investigate the feasibility of your requirements and share our feedback with you.