PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Underline by the XTextFormatter?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2771
Page 1 of 1

Author:  ZeroCool [ Wed Mar 19, 2014 11:52 am ]
Post subject:  Underline by the XTextFormatter?

Please could me anyone say, if when i draw a string with the XTextFormatter the not solid underline is intended or a bug?
I use the Version "1.32" and the PdfSharp-WPF assembly.

Look at the Image to see the Problem.

Code:
         PdfDocument pdfDocument = new PdfDocument();
         PdfPage newPdfPage = pdfDocument.AddPage();
         newPdfPage.Size = PdfSharp.PageSize.A4;
         newPdfPage.Orientation = PdfSharp.PageOrientation.Portrait;
         XGraphics newGfx = XGraphics.FromPdfPage(newPdfPage, XGraphicsUnit.Point);
         newGfx.ScaleTransform(72.0 / 96, 72.0 / 96);
         newGfx.TranslateTransform(94, 173);
         newGfx.MFEH = PdfFontEmbedding.Automatic;

         XTextFormatter formatter = new XTextFormatter(newGfx);
         XRect rec = new XRect(0, 0, 500, 100);
         formatter.Alignment = XParagraphAlignment.Right;
         XFont newFont = new XFont("Arial", Utility.ConvertPointsToPixels(20), XFontStyle.Bold | XFontStyle.Underline);
         formatter.DrawString("THAT IS A TEST!", newFont, XBrushes.Black, rec);
         pdfDocument.Save("C:\\NewTestPDF.pdf");


Attachments:
NotSolidUnderline.jpg
NotSolidUnderline.jpg [ 16.82 KiB | Viewed 7675 times ]

Author:  Thomas Hoevel [ Wed Mar 19, 2014 12:23 pm ]
Post subject:  Re: Underline by the XTextFormatter?

I guess this is by design: XTextFormatter splits the text into words and finally draws word by word.

With MigraDoc you get a solid underline.

The XTextFormatter class is provided "as is" to get you started. Feel free to expand it if it does not suit your needs. Or maybe use MigraDoc.

Author:  ZeroCool [ Wed Mar 19, 2014 1:00 pm ]
Post subject:  Re: Underline by the XTextFormatter?

Thanks for your answers!

I can't use MigraDoc because i must draw figures for example rectangles or ellipses and this isn't possible with MigraDoc.

So i must wait if the Problem in the other post is solved (http://forum.pdfsharp.net/viewtopic.php?f=2&t=2770).

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/