Skip to content

Commit

Permalink
refactor: resume generation
Browse files Browse the repository at this point in the history
  • Loading branch information
vighnesh153 committed Jan 26, 2025
1 parent bc1d180 commit 3c5eafb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test("Generate PDF of Resume", async ({ page }) => {
await page.goto("/resume");

await page.pdf({
path: `./public/${await page.title()}.pdf`,
path: `./public/resume.pdf`,
displayHeaderFooter: false,
landscape: false,
printBackground: true,
Expand Down
28 changes: 9 additions & 19 deletions tools-nodejs/vighnesh153-astro/website/src/pages/resume.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "@fontsource-variable/raleway";
import ContentLayout from "@/layouts/ContentLayout.astro";
import { ResumeContainer } from "@/components/resume/ResumeContainer";
import { Button } from "@/components/buttons/Button.tsx";
import { Link } from "@/components/Link.tsx";
const monthFormatter = new Intl.DateTimeFormat("en-GB", {
month: "short",
Expand All @@ -35,7 +35,14 @@ const pageTitle = `Vighnesh_Raut_CV_${formattedDate.replace(/ /g, "_")}`;
<div class="mt-32">
<div class="w-full flex items-center flex-col gap-6">
<div class="">
<Button variant="primary" id="btn-download-resume">Download</Button>
<Link
linkType="primary-btn"
href="/resume.pdf"
download={`${pageTitle}.pdf`}
target="_blank"
>
Download
</Link>
</div>
<div id="resume-container">
<div id="resume-holder">
Expand Down Expand Up @@ -126,21 +133,4 @@ const pageTitle = `Vighnesh_Raut_CV_${formattedDate.replace(/ /g, "_")}`;
import { logAnalyticsEvent } from "@/utils/firebase_config.ts";

logAnalyticsEvent("visit_resume");

document
.querySelector("#btn-download-resume")
?.addEventListener("click", () => {
// Once download as pdf feature is implemented, update this code to download pdf directly
// instead of opening the print dialog and expecting the user to download
// https://github.com/whatwg/html/issues/7946
// print();

const link = document.createElement("a");
const fileName = `${document.title}.pdf`;
link.href = `/${fileName}`;
link.download = fileName;
link.target = "_blank";

link.click();
});
</script>

0 comments on commit 3c5eafb

Please sign in to comment.