I am trying to calculate the size of a PdfFreeTextAnnotation based on a maximum width.
I am using the MeasureString method. This seams to work fine unless I want to wrap the text.
If I have a text string that is 1000 pixels wide, but my PdfFreeTextAnnotation is only 50 pixels wide, I would like to size the height of the annotation to fit the text with the maxWidth of the annotation being 50.
I tried to use this method of the PdfGraphics class.
Code: Select all
public void MeasureString(
string text,
PdfFont font,
float fontSize,
float maxWidth,
bool wordWrap,
out float width,
out float height
)However, the width value seems to default to 100 and I get a height value that seems almost arbitrary. It is generally much taller than it needs to be to fit the text for the width of 100 and to short for a width of 50.
I am using the Winforms version of the Pdf.Net plugin.
Any help would be appreciated.
Thanks
Harlan.