Font problem on server side

Stimulsoft Reports.NET discussion
Post Reply
elyasnew
Posts: 3
Joined: Sun Sep 20, 2015 1:13 pm

Font problem on server side

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Font problem on server side

Post 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.
elyasnew
Posts: 3
Joined: Sun Sep 20, 2015 1:13 pm

Re: Font problem on server side

Post 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!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Font problem on server side

Post 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.
elyasnew
Posts: 3
Joined: Sun Sep 20, 2015 1:13 pm

Re: Font problem on server side

Post 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
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Font problem on server side

Post by Ivan »

Hello,

Can you please send us a simple test project, which reproduce the issue?

Thank you.
Post Reply