Removed extra spacing between fields in pdf

This commit is contained in:
rajesh
2025-07-25 14:43:19 +05:30
parent 0232f08bcb
commit 481e3bd97f

View File

@@ -137,6 +137,7 @@ public class PdfDao {
Map<String, Boolean> stateFieldMap= new HashMap<>();
Paragraph labelParagraph = new Paragraph(label, labelFont);
labelParagraph.setSpacingAfter(-10f);
document.add(labelParagraph);
float leftMargin = 20f;
PdfContentByte canvas = writer.getDirectContent();
@@ -202,7 +203,9 @@ public class PdfDao {
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT); valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT);
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
valueTable.setSpacingAfter(-15f);
// Add the cell to the table
valueTable.addCell(valueCell);
@@ -285,6 +288,7 @@ public class PdfDao {
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT);
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
valueTable.addCell(valueCell);
valueTable.setSpacingAfter(-15f);
document.add(valueTable);
}
}
@@ -541,6 +545,8 @@ public class PdfDao {
labelCell.setBorder(Rectangle.NO_BORDER);
labelCell.setGrayFill(7);
labelCell.setPadding(5);
labelParagraph.setSpacingAfter(-10f);
// Create a PdfPTable with 1 column and add the PdfPCell to it
PdfPTable table = new PdfPTable(1);