Exemplo n.º 1
0
        public async Task <string> RenderToHtmlAsStringAsync(CertificateViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            return(await _viewRenderService.RenderViewToStringAsync(ViewName, viewModel));
        }
Exemplo n.º 2
0
        public async Task <Stream> RenderToPdfAsStreamAsync(CertificateViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            var html = await RenderToHtmlAsStringAsync(viewModel);

            return(await _pdfRenderService.RenderHtmlAsync(html, new PdfRenderOptions
            {
                Format = "A4",
                Scale = 0.8f
            }));
        }