|
|
@@ -29,7 +29,7 @@ public class PdfUtil {
|
|
|
|
|
|
|
|
|
public static ItextPdfTableVo createTable(String filename, int numColumns, int fontSize) throws Exception {
|
|
|
- Document document = new Document(PageSize.A4, 0, 0, 50, 0);//SUPPRESS
|
|
|
+ Document document = new Document(PageSize.A4, 0, 0, 50, 100);//SUPPRESS
|
|
|
File file = FileUtils.getFile(filename);
|
|
|
FileOutputStream fos = new FileOutputStream(file);
|
|
|
String afterStr_1 = StringEscapeUtils.escapeEcmaScript(filename);
|
|
|
@@ -45,8 +45,8 @@ public class PdfUtil {
|
|
|
// 设置各列列宽
|
|
|
// table.setTotalWidth(new float[]{90, 100, 100, 120, 100, 100});
|
|
|
table.setSpacingBefore(16f);
|
|
|
- table.setSplitRows(false);
|
|
|
- table.setSplitLate(true);
|
|
|
+ table.setSplitRows(true);
|
|
|
+ table.setSplitLate(false);
|
|
|
ItextPdfTableVo itextPdfTableVo = new ItextPdfTableVo();
|
|
|
itextPdfTableVo.setDocument(document);
|
|
|
itextPdfTableVo.setWriter(writer);
|
|
|
@@ -341,16 +341,16 @@ public class PdfUtil {
|
|
|
createPDFCell(tableFont, table, "演练项目", Element.ALIGN_CENTER, 1, 1);
|
|
|
createPDFCell(tableFont, table, data.get("typeText").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
//预设案由
|
|
|
- createPDFCell(tableFont, table, "预设案由", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
- createPDFCell(tableFont, table, data.get("presetCase").toString(), Element.ALIGN_LEFT, 5, 140);
|
|
|
+ createPDFCell(tableFont, table, "预设案由", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("presetCase").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
//演练情况
|
|
|
- createPDFCell(tableFont, table, "演练情况", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
- createPDFCell(tableFont, table, data.get("drillSituation").toString(), Element.ALIGN_LEFT, 5, 140);
|
|
|
+ createPDFCell(tableFont, table, "演练情况", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("drillSituation").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
//点评总结
|
|
|
- createPDFCell(tableFont, table, "点评总结", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
- createPDFCell(tableFont, table, data.get("comment").toString(), Element.ALIGN_LEFT, 5, 140);
|
|
|
+ createPDFCell(tableFont, table, "点评总结", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
+ createPDFCell(tableFont, table, data.get("comment").toString(), Element.ALIGN_LEFT, 5, 1);
|
|
|
//参会人员签字
|
|
|
- createPDFCell(tableFont, table, "参会人员签字", Element.ALIGN_MIDDLE, 1, 140);
|
|
|
+ createPDFCell(tableFont, table, "参会人员签字", Element.ALIGN_MIDDLE, 1, 1);
|
|
|
dealEduImageCell((List<String>) data.get("signImage"), table, 5, 30, 30);
|
|
|
document.add(table);
|
|
|
|
|
|
@@ -408,8 +408,8 @@ public class PdfUtil {
|
|
|
}
|
|
|
}
|
|
|
PdfPTable imageInnerTable = new PdfPTable(imageNumsOfRow);
|
|
|
- imageInnerTable.setSplitRows(false);
|
|
|
- imageInnerTable.setSplitLate(true);
|
|
|
+ imageInnerTable.setSplitRows(true);
|
|
|
+ imageInnerTable.setSplitLate(false);
|
|
|
for (String image : imageList) {
|
|
|
Image imageData = convertFileToByteArray(new File(image));
|
|
|
if (imageData != null) {
|
|
|
@@ -427,8 +427,6 @@ public class PdfUtil {
|
|
|
imageInnerTable.addCell(innerCell);
|
|
|
}
|
|
|
outCell.addElement(imageInnerTable);
|
|
|
- table.setSplitRows(false);
|
|
|
- table.setSplitLate(true);
|
|
|
table.addCell(outCell);
|
|
|
}
|
|
|
|
|
|
@@ -438,8 +436,8 @@ public class PdfUtil {
|
|
|
images = new ArrayList<>();
|
|
|
}
|
|
|
PdfPTable innerTable = new PdfPTable(ImageNumsOfRow);
|
|
|
- innerTable.setSplitRows(false);
|
|
|
- innerTable.setSplitLate(true);
|
|
|
+ innerTable.setSplitRows(true);
|
|
|
+ innerTable.setSplitLate(false);
|
|
|
//这里根据实际图片数量来判断是否需要补充白色图片,保证每行显示3张图片,用以填充空白
|
|
|
final int reallySize = images.size();
|
|
|
List<String> list = new ArrayList<>(images);
|
|
|
@@ -471,8 +469,8 @@ public class PdfUtil {
|
|
|
PdfPTable outerTable = new PdfPTable(1);
|
|
|
PdfPCell innerCell = new PdfPCell(innerTable);
|
|
|
innerCell.setBorder(Rectangle.NO_BORDER);
|
|
|
- outerTable.setSplitRows(false);
|
|
|
- outerTable.setSplitLate(true);
|
|
|
+ outerTable.setSplitRows(true);
|
|
|
+ outerTable.setSplitLate(false);
|
|
|
outerTable.addCell(innerCell);
|
|
|
return outerTable;
|
|
|
}
|