Resize logo

This commit is contained in:
rajesh
2025-09-16 13:35:21 +05:30
parent dd905e279c
commit db474e43b4

View File

@@ -94,7 +94,7 @@ public class PdfDao {
} }
// 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);