PDFsharp word wrap
c#, pdfsharp
Solution
From your code snippet I assume that `tf` is an object of the XTextFormatter class while `gfx` is an XGraphics object.
`XGraphics.DrawString` does not support line breaks.
`XTextFormatter.DrawString` supports line breaks.
The error in your code: you are calling `gfx.DrawString` where you meant to call `tf.DrawString`.
Problem
How does one wrap text inside the rectangle using PDFsharp? In my attempts the text still extends off the PDF's page. Here is what was tried: ``` rect = new XRect(20, 300, 400, 100); tf.Alignment = XParagraphAlignment.Left; gfx.DrawString("\t • Please call the borrower prior to closing and confirm your arrival time and the closing location. \n", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(20, 320, 100, 100); gfx.DrawString("\t • If the borrower needs to change the closing appointment time or date for any reason please have them call McDonnell Law Firm at 866-931-8793 \n", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(20, 340, 100, 100); gfx.DrawString("\t • Completed documents must be received same day. Fax back to 888-612-4912 or email ClosingDocs@appliedtechres.com \n", font, XBrushes.Black, rect, XStringFormats.TopLeft); rect = new XRect(20, 360, 100, 100); gfx.DrawString("\t • Documents are to be returned via Fedex or UPS with shipping label provided. Documents must be dropped same day. \n", font, XBrushes.Black, rect, XStringFormats.TopLeft); ``` This is what it is doing >