|
@@ -16,7 +16,7 @@ public class PDFWrite_36 {
|
|
|
|
|
|
|
|
|
|
public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
|
|
public void write(Document doc, PdfWriter writer, PDFGoodsDto pdfGoodsDto
|
|
- , String fontUrl, String uploadDir) throws IOException, DocumentException {
|
|
|
|
|
|
+ , String fontUrl, String uploadDir, String headUrl) throws IOException, DocumentException {
|
|
|
|
|
|
// 设置字体
|
|
// 设置字体
|
|
BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
|
|
BaseFont bfHei = BaseFont.createFont(fontUrl,BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
|
|
@@ -31,24 +31,24 @@ public class PDFWrite_36 {
|
|
doc.open();// 打开文档
|
|
doc.open();// 打开文档
|
|
|
|
|
|
// -----------------------标签头----------------------
|
|
// -----------------------标签头----------------------
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
- getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto);
|
|
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
+ getPdfPTable(FontChinese11, bfHei, doc,pdfGoodsDto,headUrl);
|
|
|
|
|
|
|
|
|
|
doc.close(); //记得关闭document
|
|
doc.close(); //记得关闭document
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto) throws IOException, DocumentException {
|
|
|
|
|
|
+ private static void getPdfPTable(Font fontChinese11, BaseFont bfHei, Document doc, PDFGoodsDto pdfGoodsDto,String headUrl) throws IOException, DocumentException {
|
|
PdfPTable table = new PdfPTable(3);
|
|
PdfPTable table = new PdfPTable(3);
|
|
table = new PdfPTable(6);
|
|
table = new PdfPTable(6);
|
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
for (int i = 0; i < 6; i++) {
|
|
- Image img = Image.getInstance("H:\\Demo\\cheaper.jpg");
|
|
|
|
|
|
+ Image img = Image.getInstance(headUrl);
|
|
img.setAlignment(Image.ALIGN_CENTER); //设置图片居中
|
|
img.setAlignment(Image.ALIGN_CENTER); //设置图片居中
|
|
|
|
|
|
PdfPCell p = new PdfPCell(img,true);
|
|
PdfPCell p = new PdfPCell(img,true);
|