Skip to content

Commit cbfbd15

Browse files
committed
fix(pdf): minor badge generation issues
Signed-off-by: Andrea Marino <andrea@andreamarino.me>
1 parent ea7f3ac commit cbfbd15

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

packages/rimun-pdf/src/badges.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import fontkit from "@pdf-lib/fontkit";
22
import {
33
PDFDocument,
4-
PDFFont,
5-
PDFPage,
6-
RGB,
7-
rgb,
84
StandardFonts,
5+
rgb,
6+
type PDFFont,
7+
type PDFPage,
8+
type RGB,
99
} from "pdf-lib";
1010
import sharp from "sharp";
1111
import { z } from "zod";
@@ -137,7 +137,7 @@ async function renderBadge(
137137
}
138138

139139
if (attendee.confirmed_role) {
140-
await drawRoleBanner(
140+
drawRoleBanner(
141141
page,
142142
attendee.confirmed_group?.name === "delegate"
143143
? committeeName ?? attendee.confirmed_role.name
@@ -148,16 +148,16 @@ async function renderBadge(
148148
);
149149
}
150150

151-
const ordinal = formatOrdinal(sessionData!.edition_display);
151+
const ordinal = formatOrdinal(sessionData.edition_display);
152152

153-
await drawSessionInfo(
153+
drawSessionInfo(
154154
page,
155155
timesItalicFont,
156156
`${ordinal} Session ${sessionData?.date_start?.getFullYear()}`,
157157
opts
158158
);
159-
await drawTitle(page, pinyonFont, opts);
160-
await drawName(
159+
drawTitle(page, pinyonFont, opts);
160+
drawName(
161161
page,
162162
timesFont,
163163
timesItalicFont,
@@ -168,7 +168,7 @@ async function renderBadge(
168168
);
169169

170170
if (attendee.school)
171-
await drawSchool(
171+
drawSchool(
172172
page,
173173
timesItalicBoldFont,
174174
timesItalicFont,
@@ -178,7 +178,7 @@ async function renderBadge(
178178
);
179179

180180
if (attendee.delegation) {
181-
await drawDelegation(
181+
drawDelegation(
182182
page,
183183
timesFont,
184184
attendee.delegation.country
@@ -244,7 +244,7 @@ async function renderBadge(
244244
return doc;
245245
}
246246

247-
async function drawRoleBanner(
247+
function drawRoleBanner(
248248
page: PDFPage,
249249
text: string,
250250
color: RGB,
@@ -283,7 +283,7 @@ async function drawRoleBanner(
283283
});
284284
}
285285

286-
async function drawTitle(page: PDFPage, font: PDFFont, opts: RenderOptions) {
286+
function drawTitle(page: PDFPage, font: PDFFont, opts: RenderOptions) {
287287
const titleText = "Rome International Model United Nations";
288288
const titleTextSize = 9;
289289
const titleTextWidth = font.widthOfTextAtSize(titleText, titleTextSize);
@@ -308,7 +308,7 @@ async function drawTitle(page: PDFPage, font: PDFFont, opts: RenderOptions) {
308308
});
309309
}
310310

311-
async function drawSessionInfo(
311+
function drawSessionInfo(
312312
page: PDFPage,
313313
font: PDFFont,
314314
text: string,
@@ -325,13 +325,13 @@ async function drawSessionInfo(
325325
});
326326
}
327327

328-
async function drawName(
328+
function drawName(
329329
page: PDFPage,
330330
font: PDFFont,
331331
fontHE: PDFFont,
332332
_firstNameText: string,
333333
_lastNameText: string,
334-
isHE: boolean = false,
334+
isHE = false,
335335
opts: RenderOptions
336336
) {
337337
const firstNameText = fixNonWinAnsiString(_firstNameText, font);
@@ -399,15 +399,15 @@ async function drawName(
399399
}
400400
}
401401

402-
async function drawDelegation(
402+
function drawDelegation(
403403
page: PDFPage,
404404
font: PDFFont,
405405
_delegationText: string,
406406
opts: RenderOptions
407407
) {
408408
const delegationText = fixNonWinAnsiString(_delegationText, font);
409409

410-
let size = 11;
410+
const size = 11;
411411
const delegationTextWidth = font.widthOfTextAtSize(delegationText, size);
412412

413413
page.drawText(delegationText, {
@@ -428,7 +428,7 @@ async function drawDelegation(
428428
});
429429
}
430430

431-
async function drawSchool(
431+
function drawSchool(
432432
page: PDFPage,
433433
fontName: PDFFont,
434434
fontCountry: PDFFont,

0 commit comments

Comments
 (0)