Example #1
0
        public async Task <IActionResult> CreatePDF()
        {
            try
            {
                GlobalSettings optionalGlobalSettings = new()
                {
                    DocumentTitle = "Relatório dos Produtos"
                };
                ObjectSettings objectSettings = new()
                {
                    HtmlContent = await GetHTMLString(),
                    WebSettings =
                    {
                        DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "styles.css")
                    },
                    HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Página [page] de [toPage]", Line = true },
                    FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" }
                };

                return(File(await _relatorioService.CreatePDF(optionalGlobalSettings, objectSettings), "application/pdf"));
            }