1
0

CV Download and print options updates

This commit is contained in:
Michael Gordeev
2019-10-15 21:54:37 +03:00
parent 8ff09db5de
commit 4187decc0e
6 changed files with 35 additions and 17 deletions
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System.Net;
using SelectPdf;
namespace MyWebsite.Controllers
{
@@ -10,7 +10,10 @@ namespace MyWebsite.Controllers
public IActionResult Download()
{
byte[] data = new WebClient().DownloadData($"https://{Request.Host}/CV.pdf");
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl($"https://{Request.Host}/CV");
byte[] data = doc.Save();
doc.Close();
return File(data, "application/pdf", "[Michael Gordeev] CV.pdf");
}
}
@@ -10,6 +10,7 @@ namespace MyWebsite.Controllers
// TODO: Create custom error page
// TODO: Update Projects.json and Gallery.json
// TODO: Complete About page
// TODO: Add resume file
public IActionResult Index() =>
View();
+3 -2
View File
@@ -6,8 +6,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.9" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Select.HtmlToPdf.NetCore" Version="19.1.0" />
</ItemGroup>
<ItemGroup>
+2 -11
View File
@@ -1,21 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace MyWebsite
{
public class Program
{
public static void Main(string[] args)
{
public static void Main(string[] args) =>
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
+7 -2
View File
@@ -5,10 +5,11 @@
<header>
<h1>My resume</h1>
<a class="comment" asp-action="Download">// Download CV (.pdf) &#xE118;</a>
<a class="comment" asp-action="Download">// Download CV (.pdf) &#xE118;</a><br />
<a class="comment" onclick="PrintCV()">// Print CV &#xE749;</a>
</header>
<article>
<article id="cv">
<h3>Michael (Mikhail) A. Gordeev</h3>
<hr>
<p>
@@ -16,6 +17,7 @@
Russia<br>
Phone (Russia): +7 (996) 929-19-69<br>
Email: <a href="mailto:michael.xfox@outlook.com">michael.xfox@outlook.com</a><br>
Personal Website: <a href="//xfox111.net/" target="_blank">https://www.xfox111.net/</a>
</p>
<h4>Overall Summary:</h4>
@@ -74,6 +76,9 @@
<li>
Database: MySQL, Microsoft Access
</li>
<li>
English knowledge: C1 (Advanced )
</li>
<li>
Very energetic and ready to take new challenges
</li>
+17
View File
@@ -69,3 +69,20 @@ function UpdateProjects()
desc.innerHTML = text;
}
}
function PrintCV() {
var printFrame = window.open("", "", "height=500, width=800");
printFrame.document.write("<html>");
printFrame.document.write(document.head.outerHTML);
printFrame.document.write("<body>");
printFrame.document.write(document.getElementById("cv").outerHTML);
printFrame.document.write("</body>");
printFrame.document.write("</html>");
printFrame.document.close();
setTimeout(function () {
printFrame.print();
printFrame.close();
}, 500);
}