|
@@ -419,10 +419,11 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
int subImageWidth = imageNew.getWidth();
|
|
|
int subImageHeight = 14400;
|
|
|
|
|
|
- Document document = new Document();
|
|
|
+ FileOutputStream fos = null;
|
|
|
+
|
|
|
//设置文档页边距
|
|
|
+ Document document = new Document();
|
|
|
document.setMargins(0, 0, 0, 0);
|
|
|
- FileOutputStream fos = null;
|
|
|
|
|
|
try {
|
|
|
fos = new FileOutputStream(target);
|
|
@@ -488,7 +489,6 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
* @return 缩放后的图片
|
|
|
*/
|
|
|
public static BufferedImage scale(BufferedImage image, int width, int height) {
|
|
|
-
|
|
|
Image newImage = ImgUtil.scale(image, width, height);
|
|
|
|
|
|
// 创建一个具有相同尺寸和类型(ARGB)的新BufferedImage
|
|
@@ -517,15 +517,13 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
int canvasHeight = mmToPx(workOrder.getMaxLength().doubleValue());
|
|
|
|
|
|
// 创建一个画布,并设置白色背景
|
|
|
- BufferedImage imageNew = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
|
|
|
- Graphics graphics = imageNew.getGraphics();
|
|
|
+ BufferedImage image = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
|
|
|
+ Graphics graphics = image.getGraphics();
|
|
|
graphics.setColor(Color.WHITE);
|
|
|
graphics.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
|
|
|
|
- Map<String, BufferedImage> bufferedImageMap = new ConcurrentHashMap<>();
|
|
|
-
|
|
|
CountDownLatch downLatch = new CountDownLatch(list.size());
|
|
|
-
|
|
|
+ Map<String, BufferedImage> bufferedImageMap = new ConcurrentHashMap<>();
|
|
|
for (WorkOrderDetail workOrderDetail : list) {
|
|
|
|
|
|
executor.execute(() -> {
|
|
@@ -566,7 +564,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
|
|
|
int[] ImageArrays = bi.getRGB(0, 0, width, height, new int[width * height], 0, width);
|
|
|
|
|
|
- imageNew.setRGB(
|
|
|
+ image.setRGB(
|
|
|
x + (marginWidth - width) / 2,
|
|
|
y + (marginHeight - height) / 2,
|
|
|
width,
|
|
@@ -590,7 +588,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
throw new ServiceException("生成pdf失败");
|
|
|
}
|
|
|
|
|
|
- convert(imageNew, "E:\\test2.pdf");
|
|
|
+ convert(image, "E:\\test2.pdf");
|
|
|
|
|
|
return null;
|
|
|
}
|