1
0
mirror of https://github.com/XFox111/my-website.git synced 2026-04-22 07:28:01 +03:00

feat: references page can be appended to resume

This commit is contained in:
2024-10-22 20:53:39 +00:00
parent 8dd26ef22a
commit 77546dfde6
2 changed files with 5 additions and 1 deletions
+1
View File
@@ -11,6 +11,7 @@ SMTP_TO_EMAIL=email # Email to which emails will be sent
DOMAIN_NAME=example.com # Your domain name DOMAIN_NAME=example.com # Your domain name
RESUME_URL=URL # Location of the resume PDF RESUME_URL=URL # Location of the resume PDF
RESUME_HAS_REFS=false # Appends last page of the resume to a result PDF file
ALERT_TEXT_URL=URL # URL of a txt file with urgent message to be displayed (see app/_components/AlertMessage.tsx) ALERT_TEXT_URL=URL # URL of a txt file with urgent message to be displayed (see app/_components/AlertMessage.tsx)
CLARITY_ID=string # Clarity Analytics ID (optional, remove to disable) CLARITY_ID=string # Clarity Analytics ID (optional, remove to disable)
CLARITY_CONSENT=1 # 1 if you need to request explicit consent from user, 0 if not (requires CLARITY_ID) CLARITY_CONSENT=1 # 1 if you need to request explicit consent from user, 0 if not (requires CLARITY_ID)
+4 -1
View File
@@ -27,9 +27,12 @@ export async function GET(req: NextRequest): Promise<Response>
// Create a new PDF document with the specified page // Create a new PDF document with the specified page
const newDoc: PDFDocument = await PDFDocument.create(); const newDoc: PDFDocument = await PDFDocument.create();
const [page]: PDFPage[] = await newDoc.copyPages(srcDoc, [resume.pageIndex]); const [page, refs]: PDFPage[] = await newDoc.copyPages(srcDoc, [resume.pageIndex, srcDoc.getPageCount() - 1]);
newDoc.addPage(page); newDoc.addPage(page);
if (process.env.RESUME_HAS_REFS)
newDoc.addPage(refs);
// Serialize the new PDF document // Serialize the new PDF document
const pdfBytes: Uint8Array = await newDoc.save(); const pdfBytes: Uint8Array = await newDoc.save();