public async Task <ActionResult> SendCertification(int class_seq, int order_user_seq) { var classstudent = await _pdf.SelectStudent(class_seq, order_user_seq); var globalSettings = new GlobalSettings { ColorMode = ColorMode.Color, Orientation = Orientation.Portrait, PaperSize = new PechkinPaperSize("260mm", "190mm"), Margins = new MarginSettings { Top = 10 }, DPI = 300, DocumentTitle = "", }; var objectSettings = new ObjectSettings { PagesCount = true, HtmlContent = CertificationGenerator.GetHTMLString(classstudent), WebSettings = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "edu_certification_style.css") }, HeaderSettings = { FontName = "NanumGothic", FontSize = 9, Right = "", Line = false }, FooterSettings = { FontName = "NanumGothic", FontSize = 9, Right = "", Line = false } }; var pdf = new HtmlToPdfDocument() { GlobalSettings = globalSettings, Objects = { objectSettings } }; var file = _converter.Convert(pdf); var filePath = Path.GetTempFileName(); System.IO.File.WriteAllBytes(filePath, file); await _classstudent.SendCertification(class_seq, order_user_seq, filePath); return(Ok()); }
public async Task <IActionResult> CreateEduCertificationPDF(int class_seq, int order_user_seq) { var classstudent = await _pdf.SelectStudent(class_seq, order_user_seq); var globalSettings = new GlobalSettings { ColorMode = ColorMode.Color, Orientation = Orientation.Portrait, PaperSize = new PechkinPaperSize("260mm", "190mm"), Margins = new MarginSettings { Top = 10 }, DPI = 300, DocumentTitle = "", }; var objectSettings = new ObjectSettings { PagesCount = true, HtmlContent = CertificationGenerator.GetHTMLString(classstudent), WebSettings = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "edu_certification_style.css") }, HeaderSettings = { FontName = "NanumGothic", FontSize = 9, Right = "", Line = false }, FooterSettings = { FontName = "NanumGothic", FontSize = 9, Right = "", Line = false } }; var pdf = new HtmlToPdfDocument() { GlobalSettings = globalSettings, Objects = { objectSettings } }; var file = _converter.Convert(pdf); return(File(file, "application/pdf", $"{classstudent.class_nm}강의수료증({classstudent.name}님).pdf")); }