Page 1 of 1
Font problem on server side
Posted: Sun Sep 20, 2015 1:16 pm
by elyasnew
I have a big problem with stimulsoft report, I searched 3 days to find a solution but couldn't find any.
I have set a special font for my report and when I view the report (ViewerEvent) it shows correctly but when I want to "print a report" (PrintReport) the font style is messed up, could anyone help me how to fix it?
Re: Font problem on server side
Posted: Mon Sep 21, 2015 6:29 am
by HighAley
Hello.
Could you specify what viewer do you use?
Please, send us step-by-step instruction how to reproduce the issue.
Thank you.
Re: Font problem on server side
Posted: Tue Sep 22, 2015 8:39 am
by elyasnew
I use mvc web viewer
here is my codes:
cshtml file
Code: Select all
@Html.Stimulsoft().StiMvcViewer(
"MvcViewer1", new StiMvcViewerOptions()
{
Localization = "~/Content/Localization/fa.xml",
Actions =
{
GetReportSnapshot = "GetReportSnapshot",
ViewerEvent = "ViewerEvent",
PrintReport = "PrintReport",
ExportReport = "ExportReport"
},
Theme = StiTheme.Default,
Appearance =
{
BackgroundColor = System.Drawing.Color.Transparent,
},
Toolbar =
{
PrintDestination = StiPrintDestination.Direct,
FontFamily = "BNazanin-Regular",
Alignment = StiContentAlignment.Right
},
Exports =
{
ShowExportToCsv = false,
ShowExportToExcel2007 = false,
ShowExportToDbf = false,
ShowExportToHtml = false,
ShowExportToImageBmp = false,
ShowExportToImageMetafile = false,
ShowExportToImagePcx = false,
ShowExportToImageSvgz = false,
ShowExportToDif = false,
ShowExportToImageTiff = false,
ShowExportToRtf = false,
ShowExportToOpenDocumentCalc = false,
ShowExportToMht = false,
ShowExportToSylk = false,
ShowExportToText = false,
ShowExportToImageGif = false,
ShowExportToExcelXml = false,
ShowExportToXml = false
}
})
Controllers:
Code: Select all
public ActionResult GetReportSnapshot(string sort)
{
if (string.IsNullOrEmpty(Session["__SelectedProjectName"] as string))
{
return RedirectToAction("index", "home");
}
//Stimulsoft.Report.StiStyle style = new Stimulsoft.Report.StiStyle();
//style.Font = new System.Drawing.Font("B Nazanin", 14F);
int pid = int.Parse(Session["__SelectedProjectId"].ToString());
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Reports/Jobs.mrt"));
//report.Styles.Clear();
//report.Styles.AddRange(new Stimulsoft.Report.StiBaseStyle[] { style });
report["@PrjectId"] = pid;
report["@OrderBy"] = sort;
return StiMvcViewer.GetReportSnapshotResult(report);
}
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult();
}
public ActionResult PrintReport()
{
[b][i]//here is the exact problem, the specified font is changed to default font "Arial"
[/i][/b]
return StiMvcViewer.PrintReportResult();
}
public ActionResult ExportReport()
{
return StiMvcViewer.ExportReportResult();
}
I also used style.font but doesn't work on server side!
Re: Font problem on server side
Posted: Tue Sep 22, 2015 11:54 am
by HighAley
Hello.
You could use next css on the page with Viewer to add custom font.
Code: Select all
@font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}
Thank you.
Re: Font problem on server side
Posted: Tue Sep 22, 2015 3:58 pm
by elyasnew
I have already defined the @font-face on my css file, but it doesn't work when I print a report, although it works on the viewer page
Re: Font problem on server side
Posted: Wed Sep 23, 2015 4:50 am
by Ivan
Hello,
Can you please send us a simple test project, which reproduce the issue?
Thank you.