|
@@ -7,6 +7,7 @@ import com.itextpdf.text.*;
|
|
|
import com.itextpdf.text.pdf.*;
|
|
import com.itextpdf.text.pdf.*;
|
|
|
import com.itextpdf.text.pdf.draw.DottedLineSeparator;
|
|
import com.itextpdf.text.pdf.draw.DottedLineSeparator;
|
|
|
import com.itextpdf.text.pdf.draw.LineSeparator;
|
|
import com.itextpdf.text.pdf.draw.LineSeparator;
|
|
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
@@ -253,18 +254,25 @@ public class PDFUtil {
|
|
|
Paragraph p1 = new Paragraph();
|
|
Paragraph p1 = new Paragraph();
|
|
|
p1.add(new Chunk(new LineSeparator()));
|
|
p1.add(new Chunk(new LineSeparator()));
|
|
|
document.add(p1);
|
|
document.add(p1);
|
|
|
- Paragraph paragraph1 = new Paragraph("客户名称: " +receivingNote.getCustomerName() +" " +
|
|
|
|
|
- " 运单号: " +receivingNote.getShipmentNumber(), namefont);
|
|
|
|
|
|
|
+ PdfPTable table1 = createTable(new float[] { 240, 100});
|
|
|
|
|
+ table1.addCell(createCell("客户名称: " +receivingNote.getCustomerName(), headfont, Element.ALIGN_LEFT, 1, false));
|
|
|
|
|
+ table1.addCell(createCell("运单号: " +receivingNote.getShipmentNumber(), headfont, Element.ALIGN_LEFT, 1, false));
|
|
|
|
|
+ table1.addCell(createCell("收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址收货地址: " +receivingNote.getShipToAddress(), headfont, Element.ALIGN_LEFT, 1, false));
|
|
|
|
|
+ table1.addCell(createCell("经办人: " +receivingNote.getAgent(), headfont, Element.ALIGN_LEFT, 1, false));
|
|
|
|
|
+ document.add(table1);
|
|
|
|
|
+// Paragraph paragraph1 = new Paragraph("客户名称: " +receivingNote.getCustomerName() +" " +
|
|
|
|
|
+// " 运单号: " +receivingNote.getShipmentNumber(), namefont);
|
|
|
|
|
+ Paragraph paragraph1 = new Paragraph();
|
|
|
paragraph1.setLeading(20f); //行间距
|
|
paragraph1.setLeading(20f); //行间距
|
|
|
paragraph1.setSpacingBefore(5f); //设置段落上空白
|
|
paragraph1.setSpacingBefore(5f); //设置段落上空白
|
|
|
paragraph1.setSpacingAfter(5f); //设置段落下空白
|
|
paragraph1.setSpacingAfter(5f); //设置段落下空白
|
|
|
document.add(paragraph1);
|
|
document.add(paragraph1);
|
|
|
- Paragraph paragraph2 = new Paragraph( "收货地址: " +receivingNote.getShipToAddress()+" " +
|
|
|
|
|
- " 经办人: " +receivingNote.getAgent(), namefont);
|
|
|
|
|
- paragraph2.setLeading(20f); //行间距
|
|
|
|
|
- paragraph2.setSpacingBefore(5f); //设置段落上空白
|
|
|
|
|
- paragraph2.setSpacingAfter(5f); //设置段落下空白
|
|
|
|
|
- document.add(paragraph2);
|
|
|
|
|
|
|
+// Paragraph paragraph2 = new Paragraph( "收货地址: " +receivingNote.getShipToAddress()+" " +
|
|
|
|
|
+// " 经办人: " +receivingNote.getAgent(), namefont);
|
|
|
|
|
+// paragraph2.setLeading(20f); //行间距
|
|
|
|
|
+// paragraph2.setSpacingBefore(5f); //设置段落上空白
|
|
|
|
|
+// paragraph2.setSpacingAfter(5f); //设置段落下空白
|
|
|
|
|
+// document.add(paragraph2);
|
|
|
/*Paragraph paragraphNumber = new Paragraph("订单号: " +docNumber+"", textfont);
|
|
/*Paragraph paragraphNumber = new Paragraph("订单号: " +docNumber+"", textfont);
|
|
|
paragraphNumber.setLeading(20f); //行间距
|
|
paragraphNumber.setLeading(20f); //行间距
|
|
|
paragraphNumber.setSpacingBefore(5f); //设置段落上空白
|
|
paragraphNumber.setSpacingBefore(5f); //设置段落上空白
|
|
@@ -280,17 +288,17 @@ public class PDFUtil {
|
|
|
p3.setSpacingBefore(5f); //设置段落上空白
|
|
p3.setSpacingBefore(5f); //设置段落上空白
|
|
|
p3.setSpacingAfter(5f); //设置段落下空白
|
|
p3.setSpacingAfter(5f); //设置段落下空白
|
|
|
// 超链接
|
|
// 超链接
|
|
|
- Anchor anchor = new Anchor("baidu");
|
|
|
|
|
- anchor.setReference("www.baidu.com");
|
|
|
|
|
|
|
+// Anchor anchor = new Anchor("baidu");
|
|
|
|
|
+// anchor.setReference("www.baidu.com");
|
|
|
//document.add(anchor);
|
|
//document.add(anchor);
|
|
|
// 定位
|
|
// 定位
|
|
|
Anchor gotoP = new Anchor("goto");
|
|
Anchor gotoP = new Anchor("goto");
|
|
|
gotoP.setReference("#top");
|
|
gotoP.setReference("#top");
|
|
|
//document.add(gotoP);
|
|
//document.add(gotoP);
|
|
|
// 添加图片
|
|
// 添加图片
|
|
|
- Image image = Image.getInstance("https://img-blog.csdn.net/20180801174617455?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zNzg0ODcxMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70");
|
|
|
|
|
- image.setAlignment(Image.ALIGN_CENTER);
|
|
|
|
|
- image.scalePercent(40); //依照比例缩放
|
|
|
|
|
|
|
+// Image image = Image.getInstance("https://img-blog.csdn.net/20180801174617455?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zNzg0ODcxMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70");
|
|
|
|
|
+// image.setAlignment(Image.ALIGN_CENTER);
|
|
|
|
|
+// image.scalePercent(40); //依照比例缩放
|
|
|
//document.add(image);
|
|
//document.add(image);
|
|
|
int size = 0;
|
|
int size = 0;
|
|
|
// 表格
|
|
// 表格
|