예제 #1
0
        public async Task <string> RenderToHtmlAsStringAsync(CertificateViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            return(await _viewRenderService.RenderViewToStringAsync(ViewName, viewModel));
        }
예제 #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
            }));
        }