PdfSharpCore icon indicating copy to clipboard operation
PdfSharpCore copied to clipboard

When a single word doesn't fit in a paragraph there will be no Linebreak

Open groege opened this issue 8 years ago • 3 comments

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.

groege avatar Feb 21 '17 07:02 groege

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);

Wetzel402 avatar Apr 19 '17 20:04 Wetzel402

Thank you for the tipp :) I'll have to look into using XTextFormatter in MigraDoc rather than gfx.drawstring

groege avatar Apr 20 '17 07:04 groege

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.

https://github.com/Wetzel402/PdfSharpCore_TestApp

Wetzel402 avatar Apr 26 '17 01:04 Wetzel402