예제 #1
0
        public async Task <IActionResult> ProductCard()
        {
            try
            {
                ViewBag.FileRefPath = base.JsReportFileRefPath;
                ViewBag.ItemCount   = 10;

                var header = await _jsReport.RenderViewToStringAsync(HttpContext, RouteData, "HeaderReport", new { });

                var footer = await _jsReport.RenderViewToStringAsync(HttpContext, RouteData, "FooterReport", new { });

                HttpContext.JsReportFeature().Recipe(jsreport.Types.Recipe.ChromePdf)
                .Configure((r) => r.Template.Chrome = new Chrome
                {
                    DisplayHeaderFooter = true,
                    HeaderTemplate      = header,
                    FooterTemplate      = footer,
                    Format       = _config["ReportSetting:Format"],
                    MarginTop    = "0.7cm",
                    MarginLeft   = _config["ReportSetting:MarginLeft"],
                    MarginBottom = _config["ReportSetting:MarginBottom"],
                    MarginRight  = _config["ReportSetting:MarginRight"]
                });

                return(await Task.Run(() => View(ProductCardModel.Example())));
            }
            catch (Exception ex)
            {
                string excLog = ex.Message;
                return(BadRequest());
            }
        }
예제 #2
0
        public async Task <IActionResult> ProductCard_Label()
        {
            ViewBag.FileRefPath = base.JsReportFileRefPath;

            HttpContext.JsReportFeature().Recipe(jsreport.Types.Recipe.ChromePdf)
            .Configure((r) => r.Template.Chrome = new Chrome
            {
                DisplayHeaderFooter = false,
                HeaderTemplate      = null,
                FooterTemplate      = null,
                Width        = "8cm",
                Height       = "5.5cm",
                MarginTop    = "0.5cm",
                MarginLeft   = "0.5cm",
                MarginBottom = "0.5cm",
                MarginRight  = "0.5cm"
            });
            return(await Task.Run(() => View(ProductCardModel.Example())));
        }