PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Jul 15, 2024 6:47 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Mar 19, 2014 11:52 am 
Offline

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

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

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

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


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 27 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