Welcome GuestLogin

PDFsharp and MigraDoc Wiki

RSS RSS

Navigation




Quick Search
»

PoweredBy

Visit the new Website for PDFsharp & MigraDoc Foundation 6.0 for .NET 6 and find information about the new version for Windows, Linux, and other platforms.

What are "Private Fonts"?

Private fonts refers to fonts that ship with your application, fonts that are not installed (or do not have to be installed) on the computer that executes your application.

When do I use "Private Fonts"?

You use private fonts when you cannot or don't want to install those fonts on that computer. Or when your application has insufficient privileges to read the fonts from the system.

For applications running on web servers, it may be impossible to install the fonts on the server due to limited rights. Or your application may have insufficient rights to access the font files on the computer.

Administrator privileges are needed to install fonts on a computer. If you use private fonts, your application can be installed and used even without administrator privileges (e.g. using XCopy deployment) and your application can still use the fonts you include in your assembly or your folder.

How do I use "Private Fonts"?

Currently there are two methods, but not all platforms support both methods.

IFontResolver

IFontResolver is new with PDFsharp 1.50.
It cannot be used with the GDI build of PDFsharp.
It cannot be used with the WPF build of PDFsharp if you want to use the DocumentPreview - fonts used with IFontResolver are not available in the preview.
For all other platforms (Silverlight, Windows Phone) this is the method of choice.

XPrivateFontCollection

XPrivateFontCollection is no longer supported and not recommended (as of PDFsharp 1.50 beta 3b).
It should work with GDI and WPF builds.

FontFamily

The class System.Windows.Media.FontFamily is part of WPF, therefore this method can only be used with the WPF build.

Sample Code

PDFsharp Sample: Font Resolver shows how to use IFontResolver. This method can be used with any build of PDFsharp 1.50 and later except for the GDI build.

Using "Private Fonts" with MigraDoc

MigraDoc uses PDFsharp to create PDF files. You have to register your private fonts with PDFsharp and MigraDoc will use them when creating PDF files.

MigraDoc will not embed private fonts when creating RTF files.


Visit the new Website for PDFsharp & MigraDoc Foundation 6.0 for .NET 6 and find information about the new version for Windows, Linux, and other platforms.



Miscellaneous
Home
PDFsharp
FAQ
Samples
Articles
MigraDoc
FAQ
Samples
Articles

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.

Impressum - Privacy Policy, Data Protection Declaration, Legal Notice