Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from admin-ch/release/version-1.1
Browse files Browse the repository at this point in the history
VACCINECER-977: update pdf
  • Loading branch information
fabe2913 authored Jun 15, 2021
2 parents e389b7b + 161006a commit 42a7c23
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class CovidPdfCertificateGenerationService {

private final Font font8English;

private final Font font7English;

private final Font fontHeaderRed;

private final Font fontHeaderBlack;
Expand Down Expand Up @@ -90,6 +92,7 @@ public CovidPdfCertificateGenerationService(ConfigurableEnvironment env) throws
fontRowBold = new Font(baseFontBold, 10, Font.NORMAL, BaseColor.BLACK);
fontEnglish = new Font(baseFontItalic, 9, Font.NORMAL, BaseColor.BLACK);
font8English = new Font(baseFontItalic, 8, Font.NORMAL, BaseColor.BLACK);
font7English = new Font(baseFontItalic, 7, Font.NORMAL, BaseColor.BLACK);
fontHeaderRed = new Font(baseFont, 26, Font.NORMAL, new BaseColor(220, 0, 24));
fontHeaderBlack = new Font(baseFontItalic, 16, Font.NORMAL, BaseColor.BLACK);

Expand Down Expand Up @@ -186,7 +189,7 @@ private PdfPTable headerTable(Locale locale) {
cell.setPaddingLeft(-5);
cell.setPaddingTop(30);
cell.setBorder(Rectangle.NO_BORDER);
cell.setFixedHeight(90);
cell.setFixedHeight(70);
cell.setRowspan(2);
cell.setVerticalAlignment(Rectangle.TOP);
table.addCell(cell);
Expand Down Expand Up @@ -215,7 +218,7 @@ private PdfPTable mainTable(Locale locale, AbstractCertificatePdf data, Image qr
cell.setVerticalAlignment(Element.ALIGN_TOP);
cell.setBorder(Rectangle.NO_BORDER);
cell.setRowspan(30);
cell.setFixedHeight(430);
cell.setFixedHeight(390);
table.addCell(cell);

if (data instanceof VaccinationCertificatePdf) {
Expand Down Expand Up @@ -271,7 +274,7 @@ private PdfPTable addLeftColumn(Locale locale, Image qrCode, AbstractCertificate
cell.setVerticalAlignment(Element.ALIGN_TOP);
cell.setBorder(Rectangle.NO_BORDER);
cell.setColspan(2);
cell.setPaddingTop(32);
cell.setPaddingTop(22);
cell.setPaddingLeft(22);
table.addCell(cell);

Expand All @@ -280,12 +283,12 @@ private PdfPTable addLeftColumn(Locale locale, Image qrCode, AbstractCertificate
cell2.setBorder(Rectangle.NO_BORDER);
cell2.setColspan(2);
cell2.setPaddingLeft(PADDING_LEFT);
cell2.setPaddingTop(15);
cell2.setPaddingTop(5);
table.addCell(cell2);

addQrLabelCell(table, locale, LocalDateTime.now());

addIssuerRow(table, locale, "personalData.title", 20, true, PADDING_LEFT);
addIssuerRow(table, locale, "personalData.title", 10, true, PADDING_LEFT);
addRow(table, locale, "personalData.name.label", data.getFamilyName() + " " + data.getGivenName(), PADDING_LEFT);
addRow(table, locale, "personalData.date.label", data.getDateOfBirth().format(LOCAL_DATE_FORMAT), PADDING_LEFT);

Expand Down Expand Up @@ -367,18 +370,25 @@ private void addIssuerRow(PdfPTable table, Locale locale, String key, int paddin
private void addQrLabelCell(PdfPTable table, Locale locale, LocalDateTime dateTime) {
String date = dateTime.format(LOCAL_DATE_FORMAT);
String time = dateTime.format(DateTimeFormatter.ofPattern("HH:mm"));
PdfPCell titleCell = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, locale), font8Row));
titleCell.setBorder(Rectangle.NO_BORDER);
titleCell.setColspan(2);
titleCell.setPaddingLeft(PADDING_LEFT);
table.addCell(titleCell);

PdfPCell issuerCell = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, Locale.ENGLISH), font8English));
issuerCell.setBorder(Rectangle.NO_BORDER);
issuerCell.setPaddingTop(0);
issuerCell.setColspan(2);
issuerCell.setPaddingLeft(PADDING_LEFT);
table.addCell(issuerCell);
PdfPCell first = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, locale), font8Row));
first.setBorder(Rectangle.NO_BORDER);
first.setColspan(2);
first.setPaddingLeft(PADDING_LEFT);
table.addCell(first);

PdfPCell second = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, Locale.ENGLISH), font8English));
second.setBorder(Rectangle.NO_BORDER);
second.setPaddingTop(0);
second.setColspan(2);
second.setPaddingLeft(PADDING_LEFT);
table.addCell(second);

PdfPCell third = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.date.label", null, Locale.ENGLISH), font8English));
third.setBorder(Rectangle.NO_BORDER);
third.setPaddingTop(0);
third.setColspan(2);
third.setPaddingLeft(PADDING_LEFT);
table.addCell(third);
}


Expand All @@ -399,7 +409,7 @@ private Chunk getLogo(String name, int scale) {
private PdfPTable issuerTable(Locale locale) {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
table.setSpacingBefore((float) 10);
table.setSpacingBefore((float) 5);

addIssuerRow(table, locale);
addIssuerRow(table, locale, "issuer.issuer", 5, true, PADDING_LEFT);
Expand All @@ -409,19 +419,22 @@ private PdfPTable issuerTable(Locale locale) {

private PdfPTable infoTable(Locale locale) {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(95);
table.setWidthPercentage(94.5f);
table.setHorizontalAlignment(Element.ALIGN_RIGHT);
table.setSpacingBefore((float) 20);
table.setSpacingBefore((float) 15);

PdfPCell cell = new PdfPCell();
addInfoCell(cell, messageSource.getMessage("info.info1", null, locale), fontRow, 0);
addInfoCell(cell, messageSource.getMessage("info.info1", null, Locale.ENGLISH), fontEnglish, 0);
addInfoCell(cell, messageSource.getMessage("info.info2", null, locale), fontRow, 10);
addInfoCell(cell, messageSource.getMessage("info.info2", null, Locale.ENGLISH), fontEnglish, 0);
addInfoCell(cell, messageSource.getMessage("info.info1", null, locale), font8Row, 0);
addInfoCell(cell, messageSource.getMessage("info.info2", null, locale), font8Row, 0);
addInfoCell(cell, messageSource.getMessage("info.info3", null, locale), font8Row, 0);
addInfoCell(cell, messageSource.getMessage("info.info1", null, Locale.ENGLISH), font7English, 10);
addInfoCell(cell, messageSource.getMessage("info.info2", null, Locale.ENGLISH), font7English, 0);
addInfoCell(cell, messageSource.getMessage("info.info3", null, Locale.ENGLISH), font7English, 0);
cell.setBackgroundColor(new BaseColor(252, 231, 232));
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setBorder(Rectangle.NO_BORDER);
cell.setPaddingBottom(10);
cell.setFixedHeight(150);
table.addCell(cell);

return table;
Expand All @@ -431,6 +444,8 @@ private void addInfoCell(PdfPCell cell, String text, Font font, float spacingBef
Paragraph paragraph = new Paragraph(new Phrase(text, font));
paragraph.setAlignment(Element.ALIGN_CENTER);
paragraph.setSpacingBefore(spacingBefore);
paragraph.setIndentationRight(5);
paragraph.setIndentationLeft(5);
cell.addElement(paragraph);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#de
document.title=Covid-Zertifikat
footer.app=Nutzen sie das Covid-Zertifikat in Papierform oder mittels App
footer.app=Nutzen Sie das Covid-Zertifikat in Papierform oder mittels App
footer.infoline=Infoline Coronavirus - Tel. +41 58 463 00 00
info.info1=Das COVID-Zertifikat ist nur gegen Vorlage eines Ausweisdokuments gültig.
info.info2=Bewahren Sie dieses Papier sorgfältig auf, auch wenn Sie das Zertifikat in der App gespeichert haben.
info.info1=Das Covid-Zertifikat ist nur gegen Vorlage eines Ausweisdokuments gültig.
info.info2=Dieses Zertifikat ist kein Reisedokument. Die wissenschaftlichen Erkenntnisse über Covid-19-Impfungen und -Tests sowie über die Genesung von einer Covid-19- Infektion entwickeln sich ständig weiter, auch im Hinblick auf neue besorgniserregende Virusvarianten. Bitte informieren Sie sich vor der Reise über die am Zielort geltenden Gesundheitsmassnahmen und damit verbundenen Beschränkungen.
info.info3=Bewahren Sie dieses Papier sorgfältig auf, auch wenn Sie das Zertifikat in der App gespeichert haben.
issuer.issuer=Bundesamt für Gesundheit BAG
issuer.title=Das Covid-Zertifikat wurde herausgegeben durch
personalData.date.label=Geburtsdatum
Expand Down Expand Up @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Hersteller
vaccination.product.label=Produkt
vaccination.title=Impfung
vaccination.type.label=Art des Impfstoffs
test.result.value=Nicht erkannt
test.result.value=Nicht erkannt (Negativ)
qrCode.date.label=Date format used: dd.mm.yyyy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ document.title=COVID certificate
footer.app=Use the COVID certificate in paper form or in the app
footer.infoline=Infoline Coronavirus - Tel. +41 58 463 00 00
info.info1=The COVID certificate is only valid on presentation of an identity document.
info.info2=Keep this document safe, even if you have saved the certificate in the app.
info.info2=This certificate is not a travel document. The scientific evidence on COVID-19 vaccination, testing and recovery continues to evolve, also in view of new variants of concern of the virus. Before travelling, please check the applicable public health measures and related restrictions applied at the point of destination.
info.info3=Keep this document safe, even if you have saved the certificate in the app.
issuer.issuer=Federal Office of Public Health FOPH
issuer.title=The COVID certificate was issued by
personalData.date.label=Date of birth
Expand Down Expand Up @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Manufacturer
vaccination.product.label=Product
vaccination.title=Vaccination
vaccination.type.label=Vaccine type
test.result.value=Not detected
test.result.value=Not detected (Negative)
qrCode.date.label=Date format used: dd.mm.yyyy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ document.title=Certificat COVID
footer.app=Utilisez le certificat COVID en papier ou dans l'application
footer.infoline=Infoline Coronavirus - Tél. +41 58 463 00 00
info.info1=Le certificat COVID est valable uniquement sur présentation d'une pièce d'identité.
info.info2=Conservez soigneusement ce document, même si vous avez enregistré le certificat dans l'application.
info.info2=Le présent certificat n'est pas un document de voyage. Les preuves scientifiques relatives à la vaccination, aux tests et au rétablissement liés à la COVID-19 continuent d'évoluer, notamment en ce qui concerne de nouveaux variants préoccupants du virus. Avant de voyager, veuillez vérifier les mesures de santé publique applicables et les restrictions connexes applicables sur le lieu de destination.
info.info3=Conservez soigneusement ce document, même si vous avez enregistré le certificat dans l'application.
issuer.issuer=Office fédéral de la santé publique OFSP
issuer.title=Le certificat COVID a été délivré par
personalData.date.label=Date de naissance
Expand All @@ -25,11 +26,12 @@ test.title=Test
test.type.label=Type
vaccination.country.label=Pays de vaccination
vaccination.date.label=Date de vaccination
vaccination.disease=Covid-19
vaccination.disease=COVID-19
vaccination.disease.label=Maladie ou agent pathogène
vaccination.dosis.label=Dose
vaccination.manufacturer.label=Fabricant
vaccination.product.label=Produit
vaccination.title=Vaccination
vaccination.type.label=Type de vaccin
test.result.value=Non détecté
test.result.value=Non détecté (Négatif)
qrCode.date.label=Date format used: dd.mm.yyyy
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
document.title=Certificato COVID
footer.app=Utilizzate il certificato COVID in forma cartacea o tramite l'app
footer.infoline=Infoline coronavirus - tel. +41 58 463 00 00
info.info1=Il certificato COVID è valido solo su presentazione un documento di legittimazione.
info.info2=Conservate con cura questo documento anche se avete salvato il certificato nell'app.
info.info1=Il certificato COVID è valido solo con la presentazione di un documento di legittimazione.
info.info2=La presente attestazione non costituisce un documento di viaggio. Si acquisiscono sempre più conoscenze scientifiche sulla vaccinazione COVID-19, sulla guarigione dalla COVID-19 e sui test COVID-19, anche sulle nuove varianti problematiche del virus. Prima di mettersi in viaggio, si informi sulle misure sanitarie e sulle relative restrizioni applicate nel luogo di destinazione.
info.info3=Conservate con cura questo documento anche se avete salvato il certificato nell'app.
issuer.issuer=Ufficio federale della sanità pubblica UFSP
issuer.title=Il certificato COVID è stato emesso da
personalData.date.label=Data di nascita
Expand Down Expand Up @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Fabbricante
vaccination.product.label=Prodotto
vaccination.title=Vaccinazione
vaccination.type.label=Tipo di vaccino
test.result.value=Non rilevato
test.result.value=Non rilevato (Negativo)
qrCode.date.label=Date format used: dd.mm.yyyy
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#rm
#rm
document.title=Certificat COVID
footer.app=Utilisai il certificat COVID en furma da palpiri u en l'app
footer.infoline=Infoline coronavirus - tel. +41 58 463 00 00
info.info1=Il certificat COVID è valaivel mo cun ina carta d'identitad u cun in passaport.
info.info2=Tegnai en salv quest palpiri cun quità, er sche Vus avais arcunà il certificat en l'app.
info.info2=Quest attest n'è betg in document da viadi. Las enconuschientschas scientificas davart la vaccinaziun cunter COVID-19, davart la guariziun da COVID-19 e davart ils tests da COVID-19 sa sviluppan cuntinuadamain, er areguard las novas variantas privlusas dal virus. As infurmai per plaschair – avant d'As metter en viadi – davart las mesiras da sanadad e davart las restricziuns che valan en il lieu da destinaziun.
info.info3=Tegnai en salv quest palpiri cun quità, er sche Vus avais arcunà il certificat en l'app.
issuer.issuer=Uffizi federal da sanadad publica UFSP
issuer.title=Il certificat COVID è vegnì emess da
personalData.date.label=Data da naschientscha
Expand All @@ -16,7 +17,7 @@ recovery.title=Guariziun
recovery.validFrom=Valaivel a partir dals
recovery.validUntil=Valaivel fin ils
test.conducted.label=Test fatg da
test.country.label=Pajais da la vaccinaziun
test.country.label=Pajais dal test
test.date.label=Data ed ura da l'emprova
test.manufacturer.label=Producent
test.name.label=Num
Expand All @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Producent
vaccination.product.label=Product
vaccination.title=Vaccinaziun
vaccination.type.label=Tip dal vaccin
test.result.value=Betg identifitgà
test.result.value=Betg identifitgà (Negativ)
qrCode.date.label=Date format used: dd.mm.yyyy
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,28 @@

public class TestModelProvider {

public static VaccinationCertificateCreateDto getVaccinationCertificateCreateDto(String medicalProductCode) {
public static VaccinationCertificateCreateDto getVaccinationCertificateCreateDto(String medicalProductCode, String language) {
return new VaccinationCertificateCreateDto(
getCovidCertificatePersonDto(),
List.of(getVaccinationCertificateDataDto(medicalProductCode)),
"de"
language
);
}

public static TestCertificateCreateDto getTestCertificateCreateDto(
String typeCode,
String manufacturerCode
public static TestCertificateCreateDto getTestCertificateCreateDto(String typeCode, String manufacturerCode, String language
) {
return new TestCertificateCreateDto(
getCovidCertificatePersonDto(),
List.of(getTestCertificateDataDto(typeCode, manufacturerCode)),
"de"
language
);
}

public static RecoveryCertificateCreateDto getRecoveryCertificateCreateDto() {
public static RecoveryCertificateCreateDto getRecoveryCertificateCreateDto(String language) {
return new RecoveryCertificateCreateDto(
getCovidCertificatePersonDto(),
List.of(getRecoveryCertificateDataDto()),
"de"
language
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void mapsTestManufacturer() {
@Test
public void mapsSampleDateTime() {
ZonedDateTime sampleDateTime = ZonedDateTime.of(LocalDateTime.of(2021, Month.APRIL, 4, 16, 25, 12), SWISS_TIMEZONE);
TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(getTestCertificateCreateDto("", ""), testValueSet);
TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(getTestCertificateCreateDto("", "", "de"), testValueSet);
assertEquals(sampleDateTime, actual.getTestInfo().get(0).getSampleDateTime());
}

Expand Down Expand Up @@ -94,4 +94,4 @@ public void mapsIdentifier() {
TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(incoming, testValueSet);
assertNotNull(actual.getTestInfo().get(0).getIdentifier());
}
}
}
Loading

0 comments on commit 42a7c23

Please sign in to comment.