|
7 | 7 | import java.nio.file.Paths; |
8 | 8 | import java.util.stream.Stream; |
9 | 9 |
|
| 10 | +import com.itextpdf.text.DocumentException; |
10 | 11 | import com.itextpdf.text.BadElementException; |
11 | 12 | import com.itextpdf.text.BaseColor; |
12 | 13 | import com.itextpdf.text.Document; |
@@ -55,19 +56,19 @@ private static void addTableHeader(PdfPTable table) { |
55 | 56 | }); |
56 | 57 | } |
57 | 58 |
|
58 | | - private static void setAbsoluteColumnWidths(PdfPTable table) { |
| 59 | + private static void setAbsoluteColumnWidths(PdfPTable table) throws DocumentException { |
59 | 60 | table.setTotalWidth(500); // Sets total table width to 500 points |
60 | 61 | table.setLockedWidth(true); |
61 | 62 | float[] columnWidths = {100f, 200f, 200f}; // Defines three columns with absolute widths |
62 | 63 | table.setWidths(columnWidths); |
63 | 64 | } |
64 | 65 |
|
65 | | - private static void setAbsoluteColumnWidthsInTableWidth(PdfPTable table) { |
| 66 | + private static void setAbsoluteColumnWidthsInTableWidth(PdfPTable table) throws DocumentException { |
66 | 67 | table.setTotalWidth(new float[] {72f, 144f, 216f}); // First column 1 inch, second 2 inches, third 3 inches |
67 | 68 | table.setLockedWidth(true); |
68 | 69 | } |
69 | 70 |
|
70 | | - private static void setRelativeColumnWidths(PdfPTable table) { |
| 71 | + private static void setRelativeColumnWidths(PdfPTable table) throws DocumentException { |
71 | 72 | // Set column widths (relative) |
72 | 73 | table.setWidths(new float[] {1, 2, 1}); |
73 | 74 | table.setWidthPercentage(80); // Table width as 80% of page width |
|
0 commit comments