Browse Source

授权pdf样式调整

njs 3 years ago
parent
commit
a0e3051816

+ 2 - 2
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/service/impl/ESignServiceImpl.java

@@ -348,8 +348,8 @@ public class ESignServiceImpl implements ESignService {
             log.error("生成PDF出错:",e);
         }
         //计算宽高
-        Float fosX = 500F;
-        Float fosY = 500F;
+        Float fosX = 520F;
+        Float fosY = 495F;
 //        for (int i =0;i<size;i++){
 //           fosY = fosY-11f;
 //        }

+ 28 - 15
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/pdf/PDFSelfUtil.java

@@ -210,6 +210,7 @@ public class PDFSelfUtil {
         private static Font namefont;
         private static Font keyfont;
         private static Font textfont;
+        private static Font centry;
         // 最大宽度
         private static int maxWidth = 520;
         // 静态代码块
@@ -222,7 +223,7 @@ public class PDFSelfUtil {
                 keyfont = new Font(bfChinese, 10, Font.BOLD);
                 namefont = new Font(bfChinese, 12, Font.BOLD);
                 textfont = new Font(bfChinese, 10, Font.NORMAL);
-
+                centry=new Font(bfChinese,12,Font.NORMAL);
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -239,7 +240,7 @@ public class PDFSelfUtil {
         paragraph.setIndentationLeft(12); //设置左缩进
         paragraph.setIndentationRight(12); //设置右缩进
         paragraph.setFirstLineIndent(24); //设置首行缩进
-        paragraph.setLeading(20f); //行间距
+        paragraph.setLeading(5f); //行间距
         paragraph.setSpacingBefore(5f); //设置段落上空白
         paragraph.setSpacingAfter(10f); //设置段落下空白
         document.add(paragraph);
@@ -260,7 +261,7 @@ public class PDFSelfUtil {
 //        Paragraph paragraph1 = new Paragraph("客户名称: " +receivingNote.getCustomerName() +"                           " +
 //        "                                                     运单号: " +receivingNote.getShipmentNumber(), namefont);
         Paragraph paragraph1 = new Paragraph();
-     /*   paragraph1.setLeading(20f); //行间距*/
+        paragraph1.setLeading(20f); //行间距
         paragraph1.setSpacingBefore(2f); //设置段落上空白
         paragraph1.setSpacingAfter(2f); //设置段落下空白
         document.add(paragraph1);
@@ -296,7 +297,7 @@ public class PDFSelfUtil {
         calendar.setTime(date);
         // 表格
         PdfPTable table = createTable(new float[] { 80, 80, 80, 80, 80, 80 ,80,80});
-        table.addCell(createCell("客  户  自  提  委  托  书", headfont, Element.ALIGN_CENTER, 8, false));
+        table.addCell(createCell("客  户  自  提  委  托  书", centry, Element.ALIGN_CENTER, 8, false));
 
 
     /*    PdfPTable table = createTable(new float[] { 160, 60, 60,60});
@@ -307,17 +308,29 @@ public class PDFSelfUtil {
                 " 委托人: "+receivingNote.getEntrustName()+"\n\n", keyfont, Element.ALIGN_LEFT, 2, false));
 
 
-*/      table.addCell(createCell(" 委托人(名称):姓名: "+receivingNote.getEntrustName(), keyfont, Element.ALIGN_LEFT, 7, true));
-        table.addCell(createCell(" 受托(提货)人:姓名: "+receivingNote.getBeentrustName(), keyfont, Element.ALIGN_LEFT, 7, false));
-        table.addCell(createCell(" 身份证号码: "+receivingNote.getbId(), keyfont, Element.ALIGN_LEFT, 7, false));
-        table.addCell(createCell(" 车牌: "+receivingNote.getCarNumber(), keyfont, Element.ALIGN_LEFT, 7, false));
-        table.addCell(createCell(" 委托人委托受托人于 "+calendar.get(Calendar.YEAR)+" 年 "+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+" 日 ", keyfont, Element.ALIGN_LEFT, 8, false));
-        table.addCell(createCell(" 来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"    上所载明的货物。", keyfont, Element.ALIGN_CENTER, 11, false));
-        table.addCell(createCell(" 特此委托! ", keyfont, Element.ALIGN_LEFT, 7, true));
-        table.addCell(createCell(" 委托人:"+receivingNote.getEntrustName(), keyfont, Element.ALIGN_LEFT, 8, false));
-        table.addCell(createCell(" 受托(提货)人:"+receivingNote.getBeentrustName(), keyfont, Element.ALIGN_LEFT, 9, false));
-        table.addCell(createCell(calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日", keyfont, Element.ALIGN_RIGHT, 10, false));
-        table.addCell(createCell("委托人盖章:", keyfont, Element.ALIGN_RIGHT, 11, false));
+*/     Paragraph paragraph6 = new Paragraph();
+        paragraph6.setLeading(20f); //行间距*/
+        document.add(paragraph1);
+        table.addCell(createCell(" 委托人(名称):姓名:      "+receivingNote.getEntrustName()+"\n\n"+
+                "受托(提货)人:姓名:       "+receivingNote.getBeentrustName()+"    身份证号码:   "+receivingNote.getbId()+"  车牌:  "+receivingNote.getCarNumber()+"\n\n"+
+                 "           委托人委托受托人于   "+calendar.get(Calendar.YEAR)+"  年  "+(calendar.get(Calendar.MONTH)+1)+"  月  "+calendar.get(Calendar.DATE)+"  日  "+" 来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"\n\n"+
+                        "  上所载明的货物。  \n\n"+
+                        "特此委托!\n\n\n\n"
+                , centry, Element.ALIGN_LEFT, 7, false));
+        document.add(paragraph1);
+       /* table.addCell(createCell("       \n " +
+                "受托(提货)人:姓名: "+receivingNote.getBeentrustName(), centry, Element.ALIGN_LEFT, 7, false));*/
+    /*    table.addCell(createCell(" 身份证号码: "+receivingNote.getbId(), centry, Element.ALIGN_LEFT, 7, false));
+        table.addCell(createCell(" 车牌: "+receivingNote.getCarNumber(), centry, Element.ALIGN_LEFT, 7, false));
+        table.addCell(createCell(" 委托人委托受托人于 "+calendar.get(Calendar.YEAR)+" 年 "+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+" 日 ", centry, Element.ALIGN_LEFT, 8, false));
+        table.addCell(createCell(" 来贵司提取交货单号为  "+receivingNote.getDeliveryNumber()+"    上所载明的货物。  \n" +
+                "特此委托!\n", keyfont, Element.ALIGN_CENTER, 8, false));
+        table.addCell(createCell(" 特此委托!\n ", keyfont, Element.ALIGN_LEFT, 7, true));*/
+        table.addCell(createCell("", keyfont, Element.ALIGN_LEFT, 7, true));
+        table.addCell(createCell(" 委托人:"+receivingNote.getEntrustName(), centry, Element.ALIGN_LEFT, 8, false));
+        table.addCell(createCell(" 受托(提货)人:"+receivingNote.getBeentrustName(), centry, Element.ALIGN_LEFT, 9, false));
+        table.addCell(createCell(calendar.get(Calendar.YEAR)+"年"+(calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日", centry, Element.ALIGN_RIGHT, 10, false));
+        table.addCell(createCell("委托人盖章:", centry, Element.ALIGN_RIGHT, 11, false));
         document.add(paragraph1);
         table.addCell(createCell("注意事项:\n" +
                 "1、受托(提货)人须携带身份证或驾驶证原件。\n" +