Open groege opened 7 years ago
I ran into a similar issue with the original PdfSharp. I'm not sure if you are working with the same problem or not but word wrapping does not work with gfx.drawstring. Instead XTextFormatter needs to be used.
//need xtextformatter for word wrapping
var tf = new XTextFormatter(gfx);
rect = new XRect(25, 150, 570, 50);
gfx.DrawRectangle(xpen, rect);
format.LineAlignment = XLineAlignment.Near;
tf.DrawString("Lengthy text that needs to wrap...", tinos, brush, rect, format);
Thank you for the tipp :) I'll have to look into using XTextFormatter in MigraDoc rather than gfx.drawstring
I created a test project based on my original .Net 4.5 project using your PdfSharp port and have text wrapping working. You can have a look here.
Linebreak currently only works on Spaces, Hyphens and Soft-Hyphens. If there aren't any of those characters the word should still be fit into the width.