diff --git a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java index 766492ec..6a2c2b8c 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/PdfDao.java @@ -211,12 +211,14 @@ public class PdfDao { // PdfPCell valueCell = new PdfPCell(new Phrase(item, valueFont)); PdfPCell valueCell = PdfUtils.htmlToPdfPCell(item, valueFont); - valueCell.setPadding(5f); // Increase padding for better spacing + valueCell.setFixedHeight(30f); // Set a fixed height for the cell + valueCell.setPaddingLeft(10f); // Adjust left padding as needed + valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering + valueCell.setPaddingBottom(6f); valueCell.setPaddingLeft(leftMargin); // Increase left margin for value valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell - valueCell.setMinimumHeight(30f); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); - valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners + valueCell.setHorizontalAlignment(Element.ALIGN_LEFT); valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners // Add the cell to the table valueTable.addCell(valueCell); @@ -285,11 +287,14 @@ public class PdfDao { } // PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont)); PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont); - valueCell.setPadding(5f); // Increase padding for better spacing + valueCell.setFixedHeight(30f); // Set a fixed height for the cell + valueCell.setPaddingLeft(10f); // Adjust left padding as needed + valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering + valueCell.setPaddingBottom(6f); valueCell.setPaddingLeft(leftMargin); // Increase left margin for value valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell - valueCell.setMinimumHeight(30f); valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + valueCell.setHorizontalAlignment(Element.ALIGN_LEFT); valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners valueTable.addCell(valueCell); document.add(valueTable); @@ -303,6 +308,7 @@ public class PdfDao { // Create a PdfPTable with dynamic column count based on stateFieldMap size Map stateFieldMap = new HashMap<>(); Map stateFieldBoolean = new HashMap<>(); +// Font textFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(178, 190, 181)); // Gray text // Populate stateFieldMap from contentResponseBean settings contentResponseBean.getSettings().stream() @@ -364,11 +370,14 @@ public class PdfDao { for (String key : orderedKeys) { String headerValue = stateFieldMap.get(key); // Header text // PdfPCell headerCell = new PdfPCell(new Phrase(headerValue)); // Create a new PdfPCell for the header - PdfPCell headerCell = PdfUtils.htmlToPdfPCell(headerValue, null); + PdfPCell headerCell = PdfUtils.htmlToPdfPCell(headerValue, textFont); headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); // Center align headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE); headerCell.setBackgroundColor(new BaseColor(178, 190, 181)); // Light gray background for header - + headerCell.setFixedHeight(30f); // Set a fixed height for the cell + headerCell.setPaddingLeft(10f); // Adjust left padding as needed + headerCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering + headerCell.setPaddingBottom(6f); table.addCell(headerCell); // Add the header cell to the table } headersAdded = true; // Prevent headers from being added again @@ -385,11 +394,13 @@ public class PdfDao { fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue)); } // PdfPCell dataCell = new PdfPCell(new Phrase(fieldValue != null ?fieldValue: "", textFont)); - PdfPCell dataCell = PdfUtils.htmlToPdfPCell(value != null ? value.toString() : "", textFont); + PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont); dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell - dataCell.setMinimumHeight(rowHeight); - dataCell.setPadding(7f); - + dataCell.setPaddingLeft(10f); // Adjust left padding as needed + dataCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering + dataCell.setPaddingBottom(6f); + dataCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + dataCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(dataCell); // Add the cell to the table } } @@ -472,13 +483,7 @@ public class PdfDao { // Process 'fileupload' and 'checkboxes' cases as in the original logic if (name.equals("fileupload")) { - if (fieldValue instanceof List && ((List) fieldValue).stream().allMatch(item -> item instanceof DocumentResponseBean)) { - List documentList = (List) fieldValue; - List names = documentList.stream() - .map(DocumentResponseBean::getName) - .collect(Collectors.toList()); - fieldValue = names; - } + continue; } else if (name.equals("checkboxes") && fieldValue instanceof List) { List check = (List) fieldValue; List settingResponseBeans = content.getSettings();