Posted by a ceTe Software moderator
Hello,
The TextArea page element will break on words, or if the word is wider than the width of the TextArea, the word will be split into multiple lines. This is expected behavior with DynamicPDF Generator product.
If you are wanting to fit the text in a line then you can calculate the text width using Font or OpenTypeFont class. You can then use this calculated width on the TextArea so it can fit the text in a line. Below is the code sample:
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
string text = "HAPPY BIRHTDAY";
Font font = Font.Helvetica;
float fontSize = 12;
float textWidth = font.GetTextWidth(text, fontsize);
TextArea area = new TextArea(text, 100, 100, textWidth, 400, font, fontSize);
page.Elements.Add(area);
document.Draw(@"C:\Temp\MyDocument.pdf");
Thanks,
ceTe Software Support Team