Hi!
I had to develop a software to create pdf runtime.
My problems are the loading of external fonts;
Code:
XPrivateFontCollection privateFontCollection = XPrivateFontCollection.Global;
Uri fontUri = new Uri(MappedApplicationPath + "public\\fonts\\");
LoadPrivateFont(privateFontCollection, fontUri, "./FRE3OF9X.ttf");
// Set font embedding to Always
XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
protected void LoadPrivateFont(XPrivateFontCollection privateFontCollection, Uri fontUri, string sFontFamilyname)
{
//Every font must be added to the global font collection. There is probably some better way to do this but this was the only method that seemed to work when deploying to any server.
//If the font has previously been added it will just error out and continue, this does not matter.
//try
//{
privateFontCollection.AddFont(fontUri + sFontFamilyname);
//privateFontCollection.Add(fontUri, sFontFamilyname);
//}
//catch
//{
//}
}
But this does not work...
Help me.
Thanks