PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 11:38 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Mar 19, 2014 10:02 am 
Offline

Joined: Wed Mar 12, 2014 10:49 am
Posts: 5
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 7924 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 19, 2014 10:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 19, 2014 10:43 am 
Offline

Joined: Wed Mar 12, 2014 10:49 am
Posts: 5
I use the assembly "PdfSharp-WPF.dll", so i think that is the WPF build.

And yes, i use the PDFsharp 1.32 Version.


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 19, 2014 1:04 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 19, 2014 1:36 pm 
Offline

Joined: Wed Mar 12, 2014 10:49 am
Posts: 5
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group