1
0
This repository has been archived on 2026-04-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
my-old-website/MyWebsite.old/Controllers/CVController.cs
T
Michael Gordeev 53e95afa2d Refactoring 1
2019-12-09 21:14:09 +03:00

28 lines
827 B
C#

using Microsoft.AspNetCore.Mvc;
using SelectPdf;
namespace MyWebsite.Controllers
{
public class CVController : Controller
{
public IActionResult Index() =>
View();
public IActionResult Download()
{
HtmlToPdf converter = new HtmlToPdf();
converter.Options.MarginTop = 25;
converter.Options.MarginBottom = 25;
PdfDocument doc = converter.ConvertUrl($"{Request.Scheme}://{Request.Host}/CV/PrintCV?pdfPreview=true");
byte[] data = doc.Save();
doc.Close();
return File(data, "application/pdf", "[Michael Gordeev] CV.pdf");
}
public IActionResult PrintCV(bool pdfPreview = false)
{
ViewData["pdfPreview"] = pdfPreview;
return View();
}
}
}