Merge pull request #343 from Kitzanos/pdf-banner-fix-prod
Cherry-pick (PDF logo fix)
This commit is contained in:
@@ -77,7 +77,7 @@ public class PdfDao {
|
|||||||
// CustomPageEvent pageEvent = new CustomPageEvent(call.getName(), 0);
|
// CustomPageEvent pageEvent = new CustomPageEvent(call.getName(), 0);
|
||||||
// writer.setPageEvent(pageEvent);
|
// writer.setPageEvent(pageEvent);
|
||||||
document.open();
|
document.open();
|
||||||
String logoUrl=null;
|
String logoUrl=defaultLogoUrl;
|
||||||
|
|
||||||
Optional<HubEntity> hubEntity=hubRepository.findById(applicationEntity.getHubId());
|
Optional<HubEntity> hubEntity=hubRepository.findById(applicationEntity.getHubId());
|
||||||
if (Boolean.TRUE.equals(validator.isProductionProfileActivated()) && applicationEntity.getCall().getId().equals(23l)) {
|
if (Boolean.TRUE.equals(validator.isProductionProfileActivated()) && applicationEntity.getCall().getId().equals(23l)) {
|
||||||
@@ -85,16 +85,16 @@ public class PdfDao {
|
|||||||
}
|
}
|
||||||
else if(hubEntity.isPresent()) {
|
else if(hubEntity.isPresent()) {
|
||||||
if (hubEntity.get().getUniqueUuid().equals("p4lk3bcx1RStqTaIVVbXs")) {
|
if (hubEntity.get().getUniqueUuid().equals("p4lk3bcx1RStqTaIVVbXs")) {
|
||||||
defaultLogoUrl = hubEntity.get().getPdfBanner();
|
logoUrl = hubEntity.get().getPdfBanner();
|
||||||
}
|
}
|
||||||
if (hubEntity.get().getUniqueUuid().equals("t7jh5wfg9QXylNaTZkPoE")) {
|
if (hubEntity.get().getUniqueUuid().equals("t7jh5wfg9QXylNaTZkPoE")) {
|
||||||
defaultLogoUrl = hubEntity.get().getPdfBanner();
|
logoUrl = hubEntity.get().getPdfBanner();
|
||||||
}
|
}
|
||||||
logoUrl=defaultLogoUrl;
|
|
||||||
}
|
}
|
||||||
// pageEvent.setTotalPages(writer.getPageNumber());
|
// pageEvent.setTotalPages(writer.getPageNumber());
|
||||||
// addLogo(document, "logo.jpg"); // Add your image path here the migration code after cherry-pick
|
// addLogo(document, "logo.jpg"); // Add your image path here the migration code after cherry-pick
|
||||||
addLogo(document, logoUrl);
|
addLogo(document, logoUrl,applicationEntity);
|
||||||
|
|
||||||
|
|
||||||
BaseColor customColor = new BaseColor(0, 128, 0); // Adjust RGB values as needed
|
BaseColor customColor = new BaseColor(0, 128, 0); // Adjust RGB values as needed
|
||||||
@@ -672,10 +672,15 @@ public class PdfDao {
|
|||||||
return valueToFind;
|
return valueToFind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLogo(Document document, String logoPath) throws Exception {
|
public void addLogo(Document document, String logoPath,ApplicationEntity applicationEntity) throws Exception {
|
||||||
Image logo = Image.getInstance(logoPath);
|
Image logo = Image.getInstance(logoPath);
|
||||||
|
if (Boolean.TRUE.equals(validator.isProductionProfileActivated()) && applicationEntity.getCall().getId().equals(23l)) {
|
||||||
|
logo.scaleToFit(120, 60);
|
||||||
|
}
|
||||||
|
else {
|
||||||
logo.scaleToFit(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin(), // Fit to document width
|
logo.scaleToFit(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin(), // Fit to document width
|
||||||
document.getPageSize().getHeight() / 4); // Adjust the height as needed (1/4th of the page height)
|
document.getPageSize().getHeight() / 4); // Adjust the height as needed (1/4th of the page height)
|
||||||
|
}
|
||||||
logo.setAlignment(Image.ALIGN_CENTER); // Align logo to center
|
logo.setAlignment(Image.ALIGN_CENTER); // Align logo to center
|
||||||
document.add(logo);
|
document.add(logo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user