|
@@ -1,13 +1,9 @@
|
|
|
package com.qmth.distributed.print.business.util;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.itextpdf.text.*;
|
|
|
import com.itextpdf.text.pdf.*;
|
|
|
import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
|
|
|
-import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
|
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
|
|
|
-import com.qmth.teachcloud.common.enums.ClassifyEnum;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -126,7 +122,7 @@ public class CreatePrintPdfUtil {
|
|
|
// 条码
|
|
|
Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfFillDto.getPackageNumber(), false, null, null);
|
|
|
code128Image.scalePercent(100);
|
|
|
- titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, 15, 3));
|
|
|
+ titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, Element.ALIGN_RIGHT, 15, 3, 1));
|
|
|
document.add(titleTable);
|
|
|
|
|
|
|
|
@@ -134,7 +130,7 @@ public class CreatePrintPdfUtil {
|
|
|
PdfPTable basicTable = PdfFillUtils.createTable(6);
|
|
|
List<Map<String, String>> basicPlate = pdfFillDto.getBasicPlate();
|
|
|
for (Map<String, String> stringMap : basicPlate) {
|
|
|
- basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont12, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
|
+ basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont12, null, 0f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
|
}
|
|
|
if (basicPlate.size() % 2 > 0) {
|
|
|
basicTable.addCell(PdfFillUtils.createCell(" ", PdfFillUtils.textFont12, null, 16f, Element.ALIGN_LEFT, 0, 1, 3));
|
|
@@ -230,23 +226,28 @@ public class CreatePrintPdfUtil {
|
|
|
// 空格
|
|
|
Paragraph blank = new Paragraph(" ");
|
|
|
// 标题table
|
|
|
- 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(pdfPackageDto.getTitle(), PdfFillUtils.textFont28, null, 50f, Element.ALIGN_CENTER, 15, 3, 1));
|
|
|
+ PdfPTable titleTable = PdfFillUtils.createTable(new float[]{80, 20});
|
|
|
+
|
|
|
// 条码
|
|
|
Image code128Image = PdfFillUtils.createBarcode(pdfWriter, pdfPackageDto.getPackageNumber(), false, null, null);
|
|
|
code128Image.scalePercent(100);
|
|
|
- titleTable.addCell(PdfFillUtils.createCell(code128Image, 50f, 15, 3));
|
|
|
- document.add(titleTable);
|
|
|
+ titleTable.setPaddingTop(1);
|
|
|
+ titleTable.addCell(PdfFillUtils.createCell("", null, null, 40f, Element.ALIGN_CENTER, 15, 1, 1));
|
|
|
+ titleTable.addCell(PdfFillUtils.createCell(code128Image, 30f, Element.ALIGN_CENTER, 15, 1, 1));
|
|
|
|
|
|
+ titleTable.addCell(PdfFillUtils.createCell(pdfPackageDto.getTitle(), PdfFillUtils.textFont28, null, 50f, Element.ALIGN_CENTER, 15, 1, 2));
|
|
|
+ // 条码
|
|
|
+ document.add(titleTable);
|
|
|
+ document.add(blank);
|
|
|
+ document.add(blank);
|
|
|
document.add(blank);
|
|
|
|
|
|
// 基础信息表格
|
|
|
- PdfPTable basicTable = PdfFillUtils.createTable(1);
|
|
|
+ PdfPTable basicTable = PdfFillUtils.createTable(new float[]{30, 70});
|
|
|
List<Map<String, String>> basicPlate = pdfPackageDto.getBasicPlate();
|
|
|
for (Map<String, String> stringMap : basicPlate) {
|
|
|
- basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":" + stringMap.get("value"), PdfFillUtils.textFont24, 50f, Element.ALIGN_LEFT, 20f));
|
|
|
- document.add(blank);
|
|
|
+ basicTable.addCell(PdfFillUtils.createCell(stringMap.get("name") + ":", PdfFillUtils.textFont24, 50f, Element.ALIGN_RIGHT, 18f));
|
|
|
+ basicTable.addCell(PdfFillUtils.createCell(stringMap.get("value"), PdfFillUtils.textFont24, 50f, Element.ALIGN_LEFT, 18f));
|
|
|
}
|
|
|
document.add(basicTable);
|
|
|
document.add(blank);
|
|
@@ -281,11 +282,11 @@ public class CreatePrintPdfUtil {
|
|
|
} else if (size == 2) {
|
|
|
columnWidth = new float[]{20, 30, 20, 30};
|
|
|
} else if (size == 3) {
|
|
|
- columnWidth = new float[]{10, 25, 25, 10, 25, 25};
|
|
|
+ columnWidth = new float[]{15, 20, 15, 15, 20, 15};
|
|
|
} else if (size == 4) {
|
|
|
- columnWidth = new float[]{6, 12, 16, 16, 6, 12, 16, 16};
|
|
|
+ columnWidth = new float[]{12, 13, 13, 12, 12, 13, 13, 12};
|
|
|
} else if (size == 5) {
|
|
|
- columnWidth = new float[]{6, 10, 11, 12, 11, 6, 10, 11, 12, 11};
|
|
|
+ columnWidth = new float[]{10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
|
|
|
} else if (size == 6) {
|
|
|
columnWidth = new float[]{6, 9, 9, 9, 9, 8, 6, 9, 9, 9, 9, 8};
|
|
|
} else {
|