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!