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

Text is not completely underlined.
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2770
Page 1 of 1

Author:  ZeroCool [ Wed Mar 19, 2014 10:02 am ]
Post subject:  Text is not completely underlined.

Hello there,
i am trying to create a pdf but i have a Problem when the text is underlined and bold, then the text is not completely underlined (the last sign). This only occurs when previously a text was created, which is marked as bold.

My Problem you can see at the attached image ("ProblemWithUnderline.jpg"). When the text "PROFORMA/STORNOBELEG" is marked as bold, then the problem occurs.

Here the code to create the pdf:
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;
XFont newFont17 = new XFont("Arial", 10.6666666666667, XFontStyle.Bold);      // Test 1
newGfx.DrawString("PROFORMA/STORNOBELEG", newFont17, XBrushes.Black, 0, 205.83);
XFont newFont18 = new XFont("Arial", 10.6666666666667, XFontStyle.Bold | XFontStyle.Underline);
newGfx.DrawString("Steuernummer", newFont18, XBrushes.Black, 304, 189.83);
XFont newFont19 = new XFont("Arial", 10.6666666666667, XFontStyle.Bold | XFontStyle.Underline);
newGfx.DrawString("UStID Absender", newFont19, XBrushes.Black, 416, 189.83);
XFont newFont20 = new XFont("Arial", 10.6666666666667, XFontStyle.Bold | XFontStyle.Underline);
newGfx.DrawString("UStID Empfänger", newFont20, XBrushes.Black, 516, 189.83);
XFont newFont21 = new XFont("Arial", 10.6666666666667, XFontStyle.Bold | XFontStyle.Underline);
newGfx.DrawString("Konto", newFont21, XBrushes.Black, 632.125, 189.83);
XFont newFont22 = new XFont("Arial", 10.6666666666667, XFontStyle.Regular);
newGfx.DrawString("1234567890123", newFont22, XBrushes.Black, 304, 205.83);
XFont newFont23 = new XFont("Arial", 10.6666666666667, XFontStyle.Regular);
newGfx.DrawString("XY123456789012", newFont23, XBrushes.Black, 416, 205.83);
XFont newFont24 = new XFont("Arial", 10.6666666666667, XFontStyle.Regular);
newGfx.DrawString("XY123456789012", newFont24, XBrushes.Black, 516, 205.83);
XFont newFont25 = new XFont("Arial", 10.6666666666667, XFontStyle.Regular);
newGfx.DrawString("10000", newFont25, XBrushes.Black, 630.338541666667, 205.83);
pdfDocument.Save("C:\\NewTestPDF.pdf");


Thanks a lot for the help!

Attachments:
ProblemWithUnderline.jpg
ProblemWithUnderline.jpg [ 45.87 KiB | Viewed 7930 times ]

Author:  Thomas Hoevel [ Wed Mar 19, 2014 10:22 am ]
Post subject:  Re: Text is not completely underlined.

Hi!

Does this occur with GDI+ build or with WPF build?
Have you tried the other build?

I presume you are using PDFsharp 1.32.

Author:  ZeroCool [ Wed Mar 19, 2014 10:43 am ]
Post subject:  Re: Text is not completely underlined.

I use the assembly "PdfSharp-WPF.dll", so i think that is the WPF build.

And yes, i use the PDFsharp 1.32 Version.

Author:  Thomas Hoevel [ Wed Mar 19, 2014 1:04 pm ]
Post subject:  Re: Text is not completely underlined.

Underlines are correct with the GDI+ build (DLL "PdfSharp.dll").

So switching to the other implementation would solve this issue.
Is this an option for you?

Author:  ZeroCool [ Wed Mar 19, 2014 1:36 pm ]
Post subject:  Re: Text is not completely underlined.

I work with the .net Framework 4.0 so thought i must work with the WPF-Version. But when you say that they are any problems to work with the .net Framework 4.0 and the GDI+ Version, so i can use it also.

Thanks a lot ...

PS: I have tried the GDI+ assembly, offhand everything seems to be allright.

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