|
@@ -32,7 +32,7 @@ public class CreatePrintPdfUtil {
|
|
public File createSignPdf(PdfSignDto pdfFillDto, String destFileName) throws Exception {
|
|
public File createSignPdf(PdfSignDto pdfFillDto, String destFileName) throws Exception {
|
|
|
|
|
|
// 1:建立Document对象实例
|
|
// 1:建立Document对象实例
|
|
- Document document = new Document(PageSize.A4, 36.0F, 36.0F, 40F, 36.0F);
|
|
|
|
|
|
+ Document document = new Document(PageSize.A4, 20F, 20F, 40F, 36F);
|
|
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
File file = createFolder(destFileName);
|
|
File file = createFolder(destFileName);
|
|
FileOutputStream fos = null;
|
|
FileOutputStream fos = null;
|
|
@@ -118,7 +118,7 @@ public class CreatePrintPdfUtil {
|
|
// 标题table
|
|
// 标题table
|
|
PdfPTable titleTable = PdfFillUtils.createTable(new float[]{33, 34, 33});
|
|
PdfPTable titleTable = PdfFillUtils.createTable(new float[]{33, 34, 33});
|
|
titleTable.addCell(PdfFillUtils.createCell("", null, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
|
|
titleTable.addCell(PdfFillUtils.createCell("", null, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
|
|
- titleTable.addCell(PdfFillUtils.createCell(pdfFillDto.getTitle(), PdfFillUtils.textFont18, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
|
|
|
|
|
|
+ titleTable.addCell(PdfFillUtils.createCell(pdfFillDto.getTitle(), PdfFillUtils.textFont14, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
|
|
// 条码
|
|
// 条码
|
|
Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfFillDto.getPackageNumber(), false, null, null);
|
|
Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfFillDto.getPackageNumber(), false, null, null);
|
|
code128Image.scalePercent(100);
|
|
code128Image.scalePercent(100);
|
|
@@ -130,10 +130,10 @@ public class CreatePrintPdfUtil {
|
|
PdfPTable basicTable = PdfFillUtils.createTable(6);
|
|
PdfPTable basicTable = PdfFillUtils.createTable(6);
|
|
List<Map<String, String>> basicPlate = pdfFillDto.getBasicPlate();
|
|
List<Map<String, String>> basicPlate = pdfFillDto.getBasicPlate();
|
|
for (Map<String, String> stringMap : basicPlate) {
|
|
for (Map<String, String> stringMap : basicPlate) {
|
|
- basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont12, null, 0f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
|
|
|
|
+ basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont9, null, 0f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
}
|
|
}
|
|
if (basicPlate.size() % 2 > 0) {
|
|
if (basicPlate.size() % 2 > 0) {
|
|
- basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont12, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
|
|
|
|
+ basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont9, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
}
|
|
}
|
|
document.add(basicTable);
|
|
document.add(basicTable);
|
|
|
|
|
|
@@ -152,7 +152,11 @@ public class CreatePrintPdfUtil {
|
|
int j = 0;
|
|
int j = 0;
|
|
for (Map.Entry<String, String> entry : studentHeadPlate.entrySet()) {
|
|
for (Map.Entry<String, String> entry : studentHeadPlate.entrySet()) {
|
|
headKeys[columnCount * i + j] = entry.getKey();
|
|
headKeys[columnCount * i + j] = entry.getKey();
|
|
- studentTable.addCell(PdfFillUtils.createCell(entry.getValue(), PdfFillUtils.textFont12, BaseColor.LIGHT_GRAY, 16f, Element.ALIGN_CENTER, 0, 1, 1));
|
|
|
|
|
|
+ String value = entry.getValue();
|
|
|
|
+ if("座位号".equals(value)){
|
|
|
|
+ value = "座号";
|
|
|
|
+ }
|
|
|
|
+ studentTable.addCell(PdfFillUtils.createCell(value, PdfFillUtils.textFont9, BaseColor.LIGHT_GRAY, 16f, Element.ALIGN_CENTER, 0, 1, 1));
|
|
j++;
|
|
j++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -171,7 +175,7 @@ public class CreatePrintPdfUtil {
|
|
|
|
|
|
if (studentPlateCount % 2 > 0 && 2 * i + 1 == studentPlate.size()) {
|
|
if (studentPlateCount % 2 > 0 && 2 * i + 1 == studentPlate.size()) {
|
|
for (int i1 = 0; i1 < columnCount; i1++) {
|
|
for (int i1 = 0; i1 < columnCount; i1++) {
|
|
- studentTable.addCell(PdfFillUtils.createCell("", PdfFillUtils.textFont12, null, 0, Element.ALIGN_CENTER, 0, 1, 1));
|
|
|
|
|
|
+ studentTable.addCell(PdfFillUtils.createCell("", PdfFillUtils.textFont8, null, 0, Element.ALIGN_CENTER, 0, 1, 1));
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -185,7 +189,7 @@ public class CreatePrintPdfUtil {
|
|
|
|
|
|
document.add(blank);
|
|
document.add(blank);
|
|
|
|
|
|
- Paragraph pDate = new Paragraph(" 年 月 日", PdfFillUtils.textFont12);
|
|
|
|
|
|
+ Paragraph pDate = new Paragraph(" 年 月 日", PdfFillUtils.textFont9);
|
|
pDate.setAlignment(Element.ALIGN_RIGHT);
|
|
pDate.setAlignment(Element.ALIGN_RIGHT);
|
|
pDate.setIndentationRight(20);
|
|
pDate.setIndentationRight(20);
|
|
|
|
|
|
@@ -195,7 +199,7 @@ public class CreatePrintPdfUtil {
|
|
PdfPCell cell34 = new PdfPCell();
|
|
PdfPCell cell34 = new PdfPCell();
|
|
cell34.setBorderWidth(0.5F);
|
|
cell34.setBorderWidth(0.5F);
|
|
cell34.setMinimumHeight(20);
|
|
cell34.setMinimumHeight(20);
|
|
- cell34.setPhrase(new Paragraph("监考老师签名处", PdfFillUtils.textFont12));
|
|
|
|
|
|
+ cell34.setPhrase(new Paragraph("监考老师签名处", PdfFillUtils.textFont9));
|
|
cell34.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
cell34.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
|
cell34.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
cell34.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
signTable.addCell(cell34);
|
|
signTable.addCell(cell34);
|
|
@@ -313,9 +317,9 @@ public class CreatePrintPdfUtil {
|
|
} else if (size == 3) {
|
|
} else if (size == 3) {
|
|
columnWidth = new float[]{15, 20, 15, 15, 20, 15};
|
|
columnWidth = new float[]{15, 20, 15, 15, 20, 15};
|
|
} else if (size == 4) {
|
|
} else if (size == 4) {
|
|
- columnWidth = new float[]{12, 13, 13, 12, 12, 13, 13, 12};
|
|
|
|
|
|
+ columnWidth = new float[]{6, 14, 15, 15, 6, 14, 15, 15};
|
|
} else if (size == 5) {
|
|
} else if (size == 5) {
|
|
- columnWidth = new float[]{10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
|
|
|
|
|
|
+ columnWidth = new float[]{4, 8, 10, 20, 8, 4, 8, 10, 20, 8};
|
|
} else if (size == 6) {
|
|
} else if (size == 6) {
|
|
columnWidth = new float[]{6, 9, 9, 9, 9, 8, 6, 9, 9, 9, 9, 8};
|
|
columnWidth = new float[]{6, 9, 9, 9, 9, 8, 6, 9, 9, 9, 9, 8};
|
|
} else {
|
|
} else {
|
|
@@ -331,7 +335,7 @@ public class CreatePrintPdfUtil {
|
|
* @param percent 宽度
|
|
* @param percent 宽度
|
|
*/
|
|
*/
|
|
private Font chooseFont(String value, float percent) {
|
|
private Font chooseFont(String value, float percent) {
|
|
- if (StringUtils.isNotBlank(value)) {
|
|
|
|
|
|
+ /*if (StringUtils.isNotBlank(value)) {
|
|
if (value.length() < percent) {
|
|
if (value.length() < percent) {
|
|
return PdfFillUtils.textFont12;
|
|
return PdfFillUtils.textFont12;
|
|
} else if (value.length() >= percent && value.length() < 1.5 * percent) {
|
|
} else if (value.length() >= percent && value.length() < 1.5 * percent) {
|
|
@@ -339,8 +343,8 @@ public class CreatePrintPdfUtil {
|
|
} else if (value.length() >= 1.5 * percent && value.length() < 2 * percent) {
|
|
} else if (value.length() >= 1.5 * percent && value.length() < 2 * percent) {
|
|
return PdfFillUtils.textFont9;
|
|
return PdfFillUtils.textFont9;
|
|
}
|
|
}
|
|
- }
|
|
|
|
- return PdfFillUtils.textFont12;
|
|
|
|
|
|
+ }*/
|
|
|
|
+ return PdfFillUtils.textFont9;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|