PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 1:47 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 Aug 21, 2019 9:46 am 
Offline

Joined: Wed Aug 21, 2019 9:19 am
Posts: 3
Hi!

I have made a custom class for protocol reporting and printing. I set it up in a Windows Forms test project. There I created a DocumentPreview (using MDDDL for future WPF compatibility) and displayed it in a dialog:

Code:
      var preview = new DocumentPreview();
      preview.Document = DdlReader.DocumentFromString(protocol.GetDocumentDDL());

      var previewDialog = new PreviewDialog(preview);
      previewDialog.ShowDialog();


It looked great.
Attachment:
migra-01-good.png
migra-01-good.png [ 1.94 KiB | Viewed 10127 times ]


But after moving my protocol classes to an other project, an existing Windows Forms project with a big code base, the preview looked rather bad:
Attachment:
migra-02-bad.png
migra-02-bad.png [ 1.98 KiB | Viewed 10127 times ]


Both, test project and the other project are using:
MigraDoc: 1.50.5147 (gdi) from NuGet
Net-Framework: 4.5.2

My custom project for the protocol classes uses:
MigraDoc: 1.50.5147 (no gdi) from NuGet
Net-Framework: 4.5.2

Why is the preview blocky in the 2nd project?

Could it be any mysterious C# setting in the 2nd example that I'm not aware of?


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 21, 2019 11:32 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Did you take both screenshots on the same computer?

Maybe we see a TrueType font on the "good" image and a raster font (without anti-aliasing) on the "bad" image.

Maybe we see the same font, but once with "ClearType" anti-aliasing and once without any anti-aliasing.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 21, 2019 11:44 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Two screenshots taken on my computer today:
Attachment:
Performance options - performance.png
Performance options - performance.png [ 14.45 KiB | Viewed 10122 times ]

Attachment:
Performance options - appearance.png
Performance options - appearance.png [ 18.87 KiB | Viewed 10122 times ]

Make sure "best appearance" is selected on all test machines.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 21, 2019 12:10 pm 
Offline

Joined: Wed Aug 21, 2019 9:19 am
Posts: 3
First, thank you for helping with my question.

I've just applied the setting from your screenshots. It was on "Let Windows choose..", now I set it to "Adjust for best appearance". But it didn't help unfortunately.

Booth screenshots were made on the same computer and the same display.

Also to me it looks as if the bad quality example misses some kind of "Clear type".

But I have no idea, why. Both examples are started in the same VS2017 successively, and both examples have the same PdfSharp and MigraDoc references.

So I only can suppose that in the bad quality example (with the big code base) somewhere a setting is applied that causes the DocumentPreview() to be created without AntiAliasing.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 21, 2019 12:38 pm 
Offline

Joined: Wed Aug 21, 2019 9:19 am
Posts: 3
I found it!

In the bad quality example there is an evil setting in Program.cs; just before Application.Run()
Code:
Application.SetCompatibleTextRenderingDefault(false);


I've just to find out why this is there, but when I comment out this line the protocol preview looks great:-)


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: Google [Bot] and 148 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