Cannot print Asp.net MVC 5.2.2 view in Rotativa.MVC 2.0.3

泄露秘密 提交于 2019-12-24 03:30:26

问题


I have a Asp.net MVC 5.2.2 web application where i have Rotativa.MVC 2.0.3 installed via nuget package. I am using Visual Studio Community 2013 Update 4 on Windows 8.1 Pro 64-bit/8GB Ram.

My view displays data from SQL Server Database and in addition to that it also displays some data in graphs using amcharts 3.13.3.

I get the following error when i call the action from the view:

[Exception: QFont::setPixelSize: Pixel size <= 0 (0) QFont::setPixelSize: Pixel size <= 0 (0) QFont::setPixelSize: Pixel size <= 0 (0)

When i add CustomSwitches = "--grayscale" it works because it prints it in black/white but I need it to work with color.

Below is the action i am calling from the view:

    public ActionResult PrintSummary()
    {
        string fileName = "PrintSummary_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
        var rotativaOptions = new Rotativa.Core.DriverOptions() { CustomSwitches = "" };
        return new ActionAsPdf("Print", new { fromPrintpdf = "numbers i pass in"})
        {
            FileName = fileName,
            RotativaOptions = rotativaOptions
        };
    }

来源:https://stackoverflow.com/questions/29475890/cannot-print-asp-net-mvc-5-2-2-view-in-rotativa-mvc-2-0-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!