The development of PDFsharp started with .NET 1.1. PDFsharp used the graphics functions of GDI+, a graphics library from Microsoft encapsulated in the
System.Drawing namespace.
The
XGraphics class of PDFsharp has functions for drawing graphics and text very similar to the
System.Drawing.Graphics class. The advantage of this approach is that PDFsharp was able to draw text and graphics not only in PDF documents, but on WinForms windows and printers too. This allows creating preview functionality in WinForms. See
Preview sample.
After Microsoft released WPF a second build of PDFsharp was developed that substitutes the GDI+ code with WPF code. The two builds co-exist using conditional compilation while sharing large parts of the source code.
GDI+ Build
The GDI+ build of PDFsharp still compiles with .NET 2.0 and C# 2. It can be used in WinForms and Web applications, as well as in WPF applications. Most PDFsharp samples are available for the GDI+ build. We include solutions for Visual Studio 2008 and Visual Studio 2005. .NET 1.1 is not supported anymore.
WPF Build
The WPF build compiles with .NET 3.5 but still uses C# 2 features only. This build is good for native WPF applications. We include solutions for Visual Studio 2008 only.
Nearly all PDFsharp samples are also available for the WPF build. The sample code itself is shared between both builds.
Hybrid Build
The Hybrid build compiles both the GDI+ code and the WPF code in one single project. This is not useful for anything but testing. The Hybrid build e. g. creates each font twice, one GDI+ font and one WPF font, and compares the results of both technologies while it is running. If a difference is detected, there must be a bug in the implementation of either the GDI+ or the WPF build. See
XGraphicsLab-WPF as a hybrid test application.
Note: The Hybrid build must not be used in real world projects.