Skip to content

Commit

Permalink
add header to first page, refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Dec 9, 2024
1 parent a9801cc commit 57bf3af
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lib/components/ApplicationForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ function writeLine(page: PDFPage, text: string, yPos: number): number {
return yPos + yPadding;
}
function writeHeader(page: PDFPage, text: string) {
page.drawText(`${text} - ${position} - ${name}`, {
x: 5,
y: page.getSize().height - 12,
size: 10,
color: rgb(0.227, 0.62, 0.749),
});
}
async function createPdfFrontPage() {
const pdfDoc = await PDFDocument.create();
const page = pdfDoc.addPage();
writeHeader(page, "Application");
let yPos = 80;
yPos = writeLine(page, "SSC Application", yPos);
yPos = writeLine(page, `Position: ${position}`, yPos);
Expand Down Expand Up @@ -94,12 +104,7 @@ async function addPdf(
uploadedDoc.getPageIndices(),
)) {
let newPage = pdfDoc.addPage(page);
newPage.drawText(`${pdfId} - ${position} - ${name}`, {
x: 5,
y: page.getSize().height - 12,
size: 10,
color: rgb(0.227, 0.62, 0.749),
});
writeHeader(newPage, pdfId);
}
}
Expand Down

0 comments on commit 57bf3af

Please sign in to comment.