Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Staff and Guest Badges for 2023 #157

Merged
merged 5 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ public void createDirectoriesAndLoadData() {
adultSeal = loadImage("staffadult.png");
youthSeal = loadImage("staffyouth.png");
childSeal = loadImage("staffchild.png");
staffBadgeBackground = loadStaffBackground("2022 Staff Badge.pdf");
guestBadgeBackground = loadStaffBackground("2022 Guest of Honor Badge.pdf");
attendeeBadgeBackground = loadBackground("2022 Attendee Badges.pdf");
specialtyBadgeBackground = loadBackground("2022 Specialty Badges.pdf");
vipBadgeBackground = loadBackground("2022 VIP Badges.pdf");
staffBadgeBackground = loadStaffBackground("2023-Staff-Badge.pdf");
guestBadgeBackground = loadStaffBackground("2023-Guest-Badge.pdf");
attendeeBadgeBackground = loadBackground("2023-Attendee-Badge_PRINT.pdf");
specialtyBadgeBackground = loadBackground("2023-Specialty-Badge_PRINT.pdf");
vipBadgeBackground = loadBackground("2023-VIP-Badge_PRINT.pdf");
plainFont = loadPlainFont();
boldFont = loadBadgeFont();
} catch (IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,14 @@ public List<StaffBadgeDTO> staffBadgeDTOsFromGuest(@NotNull List<Guest> guestLis
return staffBadgeDTOS;
}


private String getAgeStripeColor(String ageRangeAtCon) {
if (ageRangeAtCon == null) { ageRangeAtCon = "child"; }
if ("adult".equalsIgnoreCase(ageRangeAtCon)) {
return "#323E99";
return "#412B78";
} else if ("youth".equalsIgnoreCase(ageRangeAtCon)) {
return "#FFFF00";
return "#EDB741";
} else {
return "#CC202A";
return "#BF2D28";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public StaffBadgePrintFormatter(List<StaffBadgeDTO> staffList, Sides sides, Inte
badgeCreatorBack = new BadgeCreatorStaffBack(badgeResource.getBoldFont(), badgeResource.getPlainFont());
}


private PDPage generatePageFront(StaffBadgeDTO staffBadgeDTO, PDDocument document) throws IOException {
// Note: Badge front and back are in a different order in the 2021 staff badge PDF, so the front
// is actually page 1, not page 0
Expand All @@ -52,20 +51,19 @@ private PDPage generatePageFront(StaffBadgeDTO staffBadgeDTO, PDDocument documen

PDPageContentStream contentStream = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND, true, false);
PDImageXObject pdi = PDImageXObject.createFromByteArray(document, badgeImage, staffBadgeDTO.getFirstName() + ".png");
contentStream.drawImage(pdi,45+xOffset, 81+yOffset, 306, 450);
contentStream.drawImage(pdi,12+xOffset, 13+yOffset, 306, 550);
contentStream.close();

return page;
}


private PDPage generatePageBack(StaffBadgeDTO staffBadgeDTO, PDDocument document) throws IOException {
PDPage page = linkBackgroundInto(background, 0, document);
byte[] badgeImage = badgeCreatorBack.createBadge(staffBadgeDTO);

PDPageContentStream contentStream = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND, true, false);
PDImageXObject pdi = PDImageXObject.createFromByteArray(document, badgeImage, staffBadgeDTO.getLastName() + ".png");
contentStream.drawImage(pdi,45+xOffset, 81+yOffset, 306, 450);
contentStream.drawImage(pdi,12+xOffset, 13+yOffset, 306, 550);
contentStream.close();

return page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void drawAgeColorStripe(BadgeImage b, AttendeeBadgeDTO attendee) {
Rectangle ageBackground = new Rectangle(110, 112, 223, 957);
Rectangle textBoundingBox = new Rectangle(155, 180, 160, 680);
b.fillRect(ageBackground, bgColor);
b.drawVerticalCenteredString(attendee.getAgeStripeText(), textBoundingBox, boldFont, fgColor, 2);
b.drawVerticalCenteredString(attendee.getAgeStripeText(), textBoundingBox, boldFont, fgColor, 2, 0);
}

private void drawLargeName(BadgeImage b, AttendeeBadgeDTO attendee) {
Expand Down Expand Up @@ -78,7 +78,7 @@ private void drawBadgeTypeStripe(BadgeImage b, AttendeeBadgeDTO attendee) {
if (titleText.length() < 7) {
titleText = BadgeImage.buildTitleString(titleText);
}
b.drawStretchedCenteredString(titleText, textBoundingBox, boldFont, fgColor);
b.drawStretchedCenteredString(titleText, textBoundingBox, boldFont, fgColor, 0);
}
}

Expand All @@ -89,7 +89,7 @@ private void drawBadgeNumber(BadgeImage b, AttendeeBadgeDTO attendee) {
Color fgColor = BadgeImage.getInverseColor(bgColor);
Rectangle badgeNumberBounds = new Rectangle(155, 900, 160, 110);
// b.fillRect(badgeNumberBounds, Color.GREEN);
b.drawStretchedCenteredString(badgeNumber, badgeNumberBounds, plainFont, fgColor);
b.drawStretchedCenteredString(badgeNumber, badgeNumberBounds, plainFont, fgColor, 0);
}

private void drawPronoun(BadgeImage b, AttendeeBadgeDTO attendee) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@ public byte[] createBadge(StaffBadgeDTO staff) {
drawPositionsStripe(b, staff);
drawLargeName(b, staff);
drawPronouns(b, staff);
drawBadgeAgeImage(b, staff);
drawBadgeNumber(b, staff);
drawBadgeImage(b, staff);
faebiedev marked this conversation as resolved.
Show resolved Hide resolved
return b.writePNGToByteArray();
}

private void drawBadgeImage(BadgeImage b, StaffBadgeDTO staff) {
Rectangle badgeImageLocation = new Rectangle(440, 310, 450, 620);
// b.fillRect(badgeImageLocation, Color.CYAN);
b.drawStretchedImage(staff.getBadgeImage(), badgeImageLocation);
return b.writePNGToByteArray();
}
}
Loading