Question

as usual, there are a lot of posts on this in the web, but none of this helped... I use windows and Migradoc Version = "1.32.3885.0"

To generate a pdf i create a document.

var doc = new MigraDoc.DocumentObjectModel.Document();

then i define the style for the document with a font

var style = doc.Styles["Normal"];
style.Font.Name = "Adobe Fan Heiti Std B";

then i add my sections, paragraphs, etc. and print the pdf as follows

var printer = new PdfDocumentRenderer {Document = doc};
printer.RenderDocument();
printer.Save(filePath);

This works fine. However, from the designer i got another font, which was not installed on my pc. I installed the .otf files (it is HelveticaNeueLTStd-Cn.otf and two other versions of HelveticaNeueLT). I can use the new installed fonts in all programs (e.g. MSWord) but i cannot use them in my document. I get the Error

Cannot get a matching glyph typeface for font 'HelveticaNeueLT Std Cn'.

I can load the font directly from c# (not the installed one, but the source)

var tf = new GlyphTypeface(new Uri(@"C:\temp\HelveticaNeueLTStd-Cn.otf", UriKind.Absolute));

but i don't know how to embed it to my Migradoc Document...

So the question is: How to use an .otf font in a MigraDoc Document to generate a pdf (on a Windows maschine)?

Thanks.

Was it helpful?

Solution

PDFsharp cannot work with PostScript fonts.

See also:
http://www.pdfsharp.net/wiki/PostScript_fonts.ashx

OTF can contain either PostScript or TrueType fonts. PostScript font have to be converted to TrueType for use with PDFsharp/MigraDoc Foundation (see link above).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top