Font of document doesnt works after deployed into test server?

my below code doesnt works after deploying into test site…iam not able to see font of document in couriernew,11,black?..but it works locally…y like tht
Aspose.Words.DocumentBuilder oDocBuilder;

oDocBuilder = new Aspose.Words.DocumentBuilder(oDocument);
Aspose.Words.PageSetup oPageSetup = oDocBuilder.PageSetup;
oPageSetup.TopMargin = ConvertUtil.InchToPoint(1.25);
oPageSetup.BottomMargin = ConvertUtil.InchToPoint(1.25);
oPageSetup.LeftMargin = ConvertUtil.InchToPoint(1.0);
oPageSetup.RightMargin = ConvertUtil.InchToPoint(1.0);
oPageSetup.HeaderDistance = ConvertUtil.InchToPoint(1.2);
oPageSetup.FooterDistance = ConvertUtil.InchToPoint(1.2);
Aspose.Words.Font oFont = oDocBuilder.Font;
oFont.Name = "Courier New";
oFont.Size = 11;
oFont.Color = System.Drawing.Color.Black;

Hi,

Thanks for your inquiry. It maybe that the desired font was not installed on your test site server. If that is found to be the case, please see the following work around:

  • Please ensure, if the desired fonts are installed?
  • As some document formats such as DOCX can contain embedded fonts, please try to embed Courier New font among the fonts embedded in the original document.
  • Instead of default location, if your font is located in some other directory then you have to specify the location of the folder that contains the font. The sample code snippet is as follows:
Document doc = new Document(MyDir + "Rendering.doc");
// Set fonts to be scanned for under the specified directory. Do not search within folders nested this folder.
FontSettings.SetFontsFolder(@"C:\MyFonts</span>", false);
doc.Save(MyDir + "SetFontsFolder Out.pdf");

I hope, this will help.

Best Regards,

see my below code it works fine in local with correct font (couriernew,11,black) after deploying this code in Test server iam getting (TimesNewRomanPSMT,12,black)…y it is taking wrong font in test server…how to solve this issue…pls help me out?

oDocBuilder = new DocumentBuilder(oCurrentDoc);
if (sbHfnContent.Length > 0)
{
    stylesheetPath = (ConfigurationManager.AppSettings["FootnoteCSSpath"] != null) ?
    ConfigurationManager.AppSettings["FootnoteCSSpath"].ToString() : "";
    sbHfnContent.Insert(0, "" +
            "<link href=\"" + stylesheetPath + "\" type=\"text/css\" rel=\"Stylesheet\" />" + "");
    sbHfnContent.Append("");
    sbHfnContent.Replace("border=\"1\"", "border=\"0\"");
    oDocBuilder.InsertHtml(sbHfnContent.ToString());
}
Aspose.Words.PageSetup oPageSetup = oDocBuilder.PageSetup;
oPageSetup.TopMargin = ConvertUtil.InchToPoint(1.25);
oPageSetup.BottomMargin = ConvertUtil.InchToPoint(1.25);
oPageSetup.LeftMargin = ConvertUtil.InchToPoint(1.0);
oPageSetup.RightMargin = ConvertUtil.InchToPoint(1.0);
oPageSetup.HeaderDistance = ConvertUtil.InchToPoint(1.2);
oPageSetup.FooterDistance = ConvertUtil.InchToPoint(1.2);
Aspose.Words.Font oFont = oDocBuilder.Font;
oFont.ClearFormatting();
oFont.Name = "Courier New";
oFont.Size = 11;
oFont.Color = System.Drawing.Color.Black;

Hello
Thank you for additional information. Are you saving your document to PDF? If so, the difference might be caused because different set of fonts or different versions of fonts are installed in your development and your test environments.
Fonts installed in your system are used upon rendering. So if you have different set of fonts installed you might get different result after rendering.
Best regards,