ソースを参照

调整表单pdf预览偏移位置修改

lvy 4 週間 前
コミット
7b8af25d67

+ 8 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/PdfAddimgUtil.java

@@ -120,8 +120,8 @@ public class PdfAddimgUtil {
         float height = pageSize.getHeight();
         float width = pageSize.getWidth();
         if(type.equals("6")){
-            x = width * x - 27+pyzbx;
-            y = height - height * y - 30+pyzby;
+            x = width * x + pyzbx;
+            y = height - height * y + pyzby - 0.5f;
             imagePath = FileUtils.getSysLocalFileUrl()+"print/ht1234567890.png";
         }else{
             x = width * x - 20+pyzbx;
@@ -140,6 +140,12 @@ public class PdfAddimgUtil {
             float newWidth = 75f; // 新的宽度
             float newHeight = image.getScaledHeight() * (newWidth / image.getScaledWidth()); // 根据宽度计算高度
             image.scaleAbsolute(newWidth, newHeight); // 设置图片的新尺寸
+        } else {
+            image.scaleAbsolute(image.getWidth() * (8 / 9f), image.getHeight() * (8 / 9f));
+            float imageWidth = image.getWidth();
+            float imageHeight = image.getHeight();
+            x = x - imageWidth / 2;
+            y = y - imageHeight / 2;
         }
         //调整图片尺寸
         image.setAbsolutePosition(x, y);