From 38553de8fe4a824919563db827019909caa65f9c Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期三, 24 十二月 2025 10:34:59 +0800
Subject: [PATCH] 修改了对应代码
---
archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java | 304 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 229 insertions(+), 75 deletions(-)
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java b/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java
index c1081b0..41e1fe2 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java
@@ -7,15 +7,15 @@
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.Rectangle;
-import com.itextpdf.text.pdf.BaseFont;
-import com.itextpdf.text.pdf.PdfPCell;
-import com.itextpdf.text.pdf.PdfPTable;
-import com.itextpdf.text.pdf.PdfWriter;
+import com.itextpdf.text.pdf.*;
import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.domain.vo.DocumentMaterialsVoSmall;
+import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IDocumentMaterialsService;
+import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +28,10 @@
import java.io.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.Date;
import java.util.List;
@Service
@@ -36,11 +40,14 @@
private BarcodeService barcodeService;
@Autowired
private IDocumentMaterialsService documentMaterialsService;
+
+ @Autowired
+ private IArchiveRecordsService iArchiveRecordsService;
//鐢熶骇浜岀淮鐮�
public byte[] createQrCodeN(String content, int width, int height) throws IOException {
QrConfig config = new QrConfig(width, height);
- config.setMargin(3);
+ config.setMargin(0);
// 楂樼籂閿欑骇鍒�
config.setErrorCorrection(ErrorCorrectionLevel.H);
// 璁剧疆鍓嶆櫙鑹诧紝鏃簩缁寸爜棰滆壊锛堣嚜琛岄�夋嫨棰滆壊淇敼锛�
@@ -260,67 +267,130 @@
}
+ // 鑷畾涔夐〉闈簨浠剁被锛岀敤浜庡湪姣忎釜鏂伴〉闈㈡坊鍔犲嵎鍐呭皝闈㈠拰鍗峰彿
+ private class DirectoryHeaderPageEvent extends PdfPageEventHelper {
+ private String volumeNumber;
+ private BaseFont bfChinese;
+ private Font chineseFont;
+ private Font chineseFont1;
+ private Image barcodeImage;
+
+ public DirectoryHeaderPageEvent(String volumeNumber, BaseFont bfChinese, Font chineseFont, Font chineseFont1, Image barcodeImage) {
+ this.volumeNumber = volumeNumber;
+ this.bfChinese = bfChinese;
+ this.chineseFont = chineseFont;
+ this.chineseFont1 = chineseFont1;
+ this.barcodeImage = barcodeImage;
+ }
+
+ @Override
+ public void onStartPage(PdfWriter writer, Document document) {
+ try {
+ PdfContentByte cb = writer.getDirectContent();
+ float pageWidth = document.getPageSize().getWidth();
+ float pageHeight = document.getPageSize().getHeight();
+
+ // 1. 娣诲姞鏉″舰鐮侊紙灞呬腑鏄剧ず锛岄〉闈㈤《閮級
+ float barcodeWidth = barcodeImage.getScaledWidth();
+ float barcodeHeight = barcodeImage.getScaledHeight();
+ float barcodeX = (pageWidth - barcodeWidth) / 2;
+ float barcodeY = pageHeight - 50 - barcodeHeight; // 椤甸潰椤堕儴涓嬫柟50鐐�
+ barcodeImage.setAbsolutePosition(barcodeX, barcodeY);
+ cb.addImage(barcodeImage);
+
+ // 2. 娣诲姞鍗峰唴鐩綍鏍囬锛堝眳涓樉绀猴紝鏉″舰鐮佷笅鏂癸級
+ String title = "鍗� 鍐� 鐩� 褰�";
+ float titleX = pageWidth / 2;
+ float titleY = pageHeight - 100; // 椤甸潰椤堕儴涓嬫柟100鐐�
+ cb.beginText();
+ // 鍒涘缓骞惰缃爣棰樹负鍔犵矖瀛椾綋
+ Font boldTitleFont = new Font(bfChinese, 16, Font.BOLD);
+ cb.setFontAndSize(boldTitleFont.getBaseFont(), boldTitleFont.getSize());
+ cb.setColorFill(BaseColor.BLACK);
+ cb.showTextAligned(PdfContentByte.ALIGN_CENTER, title, titleX, titleY, 0);
+ cb.endText();
+
+ // 3. 娣诲姞鍗峰彿锛堝眳鍙虫樉绀猴紝鏍囬涓嬫柟锛�
+ String label = "鍗峰彿锛�";
+ String value = volumeNumber;
+ float recordInfoX = pageWidth - 30;
+ float recordInfoY = pageHeight - 130; // 椤甸潰椤堕儴涓嬫柟130鐐�
+
+ // 鍏堢粯鍒舵爣绛�"鍗峰彿锛�"
+ cb.beginText();
+ // 璁剧疆鍔犵矖瀛椾綋锛岄�氳繃Font.BOLD鍙傛暟
+ Font boldFont = new Font(bfChinese, 16, Font.BOLD);
+ cb.setFontAndSize(boldFont.getBaseFont(), boldFont.getSize());
+ cb.setColorFill(BaseColor.BLACK);
+ cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, label + value, recordInfoX, recordInfoY, 0);
+ cb.endText();
+
+ // 璁$畻鍊肩殑浣嶇疆骞剁粯鍒朵笅鍒掔嚎
+ float labelWidth = bfChinese.getWidthPoint(label, 12);
+ float valueWidth = bfChinese.getWidthPoint(value, 12);
+ float underlineStartX = recordInfoX - valueWidth;
+ float underlineEndX = recordInfoX;
+ float underlineY = recordInfoY - 2;
+
+ cb.setColorStroke(BaseColor.BLACK);
+ cb.setLineWidth(0.5f);
+ cb.moveTo(underlineStartX, underlineY);
+ cb.lineTo(underlineEndX, underlineY);
+ cb.stroke();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
//瀵煎嚭鍗峰唴鐩綍鐨刾df
public void generateFileDirectoryPdf(String pdfPath,List<DocumentMaterialsVo> dvss) throws DocumentException, IOException {
Document document = new Document();
- PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
- document.open();
-
- // 鍒涘缓琛ㄦ牸锛�5鍒楋級
- PdfPTable table = new PdfPTable(7);
-
- // 璁剧疆琛ㄦ牸瀹藉害锛堝崰椤甸潰瀹藉害鐨�100%锛�
- table.setWidthPercentage(100);
-
-
- //娣诲姞鏉″舰鐮�
- String volumeNumber = dvss.get(0).getRecordId();
- Image img = Image.getInstance(barcodeService.generateBarcodeImage(volumeNumber));
- // 璁剧疆鍥剧墖鍦≒DF涓殑浣嶇疆锛堝彲閫夛級
-// img.setAbsolutePosition(100, 100);
- // 灏嗗浘鐗囨坊鍔犲埌PDF鏂囨。涓�
- PdfPCell pdfPCell = new PdfPCell(img);
- pdfPCell.setBorder(Rectangle.NO_BORDER); // 绉婚櫎鍗曞厓鏍艰竟妗�
-
- pdfPCell.setMinimumHeight(40);
- pdfPCell.setUseAscender(true); // 璁剧疆鍙互灞呬腑
- pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 璁剧疆姘村钩灞呬腑
- pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 璁剧疆鍨傜洿灞呬腑
- pdfPCell.setColspan(2);
- pdfPCell.setPaddingBottom(30);
-// 鍒涘缓琛ㄦ牸骞惰缃垪瀹芥瘮渚�
- float[] columnWidths = {35f, 65f}; // 绗竴鍒�30%锛岀浜屽垪70%
- PdfPTable table1 = new PdfPTable(columnWidths);
-// PdfPTable table = new PdfPTable(2);
- table1.setWidthPercentage(80); // 澧炲ぇ琛ㄦ牸瀹藉害鐧惧垎姣�
- table1.setHorizontalAlignment(Element.ALIGN_LEFT); // 璁剧疆琛ㄦ牸鏁翠綋灞呬腑
- table1.setSpacingBefore(30f); // 璁剧疆琛ㄦ牸鍓嶉棿璺�
-
- table1.addCell(pdfPCell);
-
- document.add(table1);
-
-
- // 娣诲姞琛ㄥご
+ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
+
+ // 璁剧疆涓枃瀛椾綋
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font chineseFont = new Font(bfChinese, 12);
Font chineseFont1 = new Font(bfChinese, 16, Font.BOLD);
- // 娣诲姞鏍囬
- Paragraph title = new Paragraph("鍗� 鍐� 鐩� 褰�", chineseFont1);
- title.setAlignment(Element.ALIGN_CENTER);
- document.add(title);
- Paragraph withNewLine = new Paragraph("\n");
- document.add(withNewLine);
- document.add(withNewLine);
+
+ // 鑾峰彇鍗峰彿
+ String volumeNumber = dvss.get(0).getRecordId();
+
+ // 鍒涘缓鏉″舰鐮�
+ Image barcodeImage = Image.getInstance(barcodeService.generateBarcodeImage(volumeNumber));
+ barcodeImage.scaleToFit(80, 40); // 璁剧疆鏉″舰鐮佸ぇ灏�
+
+ // 娉ㄥ唽椤甸潰浜嬩欢
+ DirectoryHeaderPageEvent pageEvent = new DirectoryHeaderPageEvent(volumeNumber, bfChinese, chineseFont1, chineseFont1, barcodeImage);
+ writer.setPageEvent(pageEvent);
+
+ // 璁剧疆閫傚綋鐨勮竟璺濓紝涓哄嵎鍐呭皝闈€�佹潯褰㈢爜鍜屽嵎鍙烽鐣欑┖闂�
+ // setMargins(left, right, top, bottom) - 鍙傛暟椤哄簭锛氬乏銆佸彸銆佷笂銆佷笅
+ // 澧炲ぇ涓婅竟璺濅负160锛岀‘淇濋〉鐪夊唴瀹规湁瓒冲绌洪棿
+ document.setMargins(30, 30, 160, 30);
+ document.open();
+
+ // 杩欓噷涓嶅啀闇�瑕佸湪绗竴椤垫墜鍔ㄦ坊鍔犲嵎鍐呭皝闈㈠唴瀹癸紝椤甸潰浜嬩欢浼氬鐞�
+
+ // 娣诲姞涓�涓┖鐧芥钀斤紝纭繚琛ㄦ牸鍐呭涓嶄細涓庨《閮ㄥ厓绱犻噸鍙�
+ Paragraph blankParagraph = new Paragraph("");
+ document.add(blankParagraph);
+
+ // 鍒涘缓琛ㄦ牸锛�7鍒楋級
+ PdfPTable table = new PdfPTable(7);
-
- //娣诲姞鍗峰彿
- Paragraph recordInfo = new Paragraph("鍗峰彿锛�" + volumeNumber, chineseFont);
- recordInfo.setAlignment(Element.ALIGN_RIGHT);
- document.add(recordInfo);
-
- document.add(withNewLine);
- document.add(withNewLine);
+ // 璁剧疆琛ㄦ牸瀹藉害锛堝崰椤甸潰瀹藉害鐨�80%锛屽眳涓樉绀猴級
+ table.setWidthPercentage(90);
+ table.setHorizontalAlignment(Element.ALIGN_CENTER);
+
+ // 璁剧疆鍒楀姣斾緥锛岀4鍒楋紙鏂囦欢棰樺悕锛夊拰绗�2鍒楋紙鏂囦欢缂栧彿锛夎缃緱鏇村
+ float[] columnWidths = {10f, 16f, 14f, 30f, 10f, 10f, 10f}; // 璋冩暣鍒楀姣斾緥锛屽鍔犳枃浠剁紪鍙峰垪鐨勫搴�
+ table.setWidths(columnWidths);
+ // 璁剧疆琛ㄥご琛屾暟锛岃繖鏍峰垎椤垫椂姣忛〉閮戒細鑷姩閲嶅琛ㄥご
+ table.setHeaderRows(1);
+
+ // 娣诲姞琛ㄥご
String[] headers = {"搴忓彿", "鏂囦欢缂栧彿", "璐d换鑰�", "鏂囦欢棰樺悕", "鏃ユ湡", "椤靛彿", "澶囨敞"};
for (String header : headers) {
PdfPCell cell = new PdfPCell(new Paragraph(header,
@@ -347,9 +417,9 @@
table.addCell(cell);
- //搴忓彿
+ //鏂囦欢缂栧彿锛堟。鍙凤級
PdfPCell cell1 = new PdfPCell(new Paragraph(cellData.getDocumentNumber()==null?"":cellData.getDocumentNumber().toString(),
- chineseFont));
+ new Font(bfChinese, 12)));
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
@@ -413,6 +483,11 @@
// 鍒涘缓PDF鏂囨。
List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
+ if(dmfs.isEmpty())
+ return;
+
+
+ System.out.println(dmfs);
PdfWriter.getInstance(document, new FileOutputStream("09-澶囪�冭〃"+".pdf"));
document.open();
// 璁剧疆涓枃瀛椾綋
@@ -426,12 +501,22 @@
// 娣诲姞鍐呭
// String volumeNumber = "D3.4.1-05-2024-0002";
- Paragraph recordInfo = new Paragraph("鍗峰彿锛�" + volumeNumber, chineseFont);
+
+ // 鍒涘缓鍗峰彿娈佃惤锛屼娇鐢–hunk鏉ュ崟鐙鐞嗗嵎鍙峰�煎苟娣诲姞涓嬪垝绾�
+ Paragraph recordInfo = new Paragraph();
+ Chunk labelChunk = new Chunk("鍗峰彿锛�", chineseFont);
+ Chunk valueChunk = new Chunk(volumeNumber, chineseFont);
+ valueChunk.setUnderline(0.5f, -2f); // 娣诲姞涓嬪垝绾匡紝0.5f鏄嚎瀹斤紝-2f鏄嚎涓庢枃瀛楃殑璺濈
+
+ recordInfo.add(labelChunk);
+ recordInfo.add(valueChunk);
recordInfo.setAlignment(Element.ALIGN_RIGHT);
document.add(recordInfo);
- int allCnt = dmfs.get(0).getCnt() + dmfs.get(1).getCnt() + dmfs.get(2).getCnt();
+ int pcc = dmfs.size()<=1?0: dmfs.get(1).getCnt();
+ int oth = dmfs.size()<=2?0: dmfs.get(2).getCnt();
+ int allCnt = dmfs.get(0).getCnt() + pcc + oth;
document.add(new Paragraph(" 鏈� 妗� 鍗� 鍏� 鏈� 鏂� 浠� 鏉� 鏂� " + allCnt + " 椤�"+"锛屽叾涓細鏂囧瓧鏉愭枡 " +
- dmfs.get(1).getCnt() + " 椤�"+"锛屽浘鏍锋潗鏂� " + dmfs.get(2).getCnt() + " 椤�"+"锛岀収鐗� " + dmfs.get(0).getCnt() + " 寮�", chineseFont));
+ pcc + " 椤�"+"锛屽浘鏍锋潗鏂� " + oth + " 椤�"+"锛岀収鐗� " + dmfs.get(0).getCnt() + " 寮�", chineseFont));
document.add(new Paragraph("璇存槑: ", chineseFont));
@@ -475,15 +560,31 @@
}
- public void generatePdf(String pdfPath) throws IOException, DocumentException {
+ public void generatePdf(String pdfPath, Long id) throws IOException, DocumentException {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
document.open();
- String [] tits = {"妗� 鍙�:","妗f棣�(瀹�)鍙�:","缂� 寰� 鍙�: ","鍙� 鏂� 鍙�:",
- "妗� 鍗� 棰� 鍚�:","缂� 鍒� 鏃� 鏈�:","缂� 鍒� 鍗� 浣�:","淇� 绠� 鏈� 闄�:","瀵� 绾�:"};
- String [] cons = {"D3.4.1-05-2024-0002","","","绌楄鍒掕祫婧愬缓璇併��2024銆�2033鍙�","骞垮窞甯傝嚜鏉ユ按鏈夐檺鍏徃鐧戒簯鍖烘睙楂橀晣姹熼珮闀囨斂搴滆タ渚с�佹睙搴滆矾鍖椾晶鐧戒簯鍖烘睙楂橀晣姹熼珮闀囨斂搴滆タ渚с�佹睙搴滆矾鍖椾晶鏂拌渚涙按绠″伐绋�","2024-04-23","骞垮窞甯傝鍒掑拰鑷劧璧勬簮灞�鐧戒簯鍖哄垎灞�","姘镐箙",""};
+ String [] tits = {"妗e彿锛�","妗f棣�(瀹�)鍙凤細","缂╁井鍙凤細","鍙戞枃鍙凤細",
+ "妗堝嵎棰樺悕锛�","缂栧埗鏃ユ湡锛�","缂栧埗鍗曚綅锛�","淇濈鏈熼檺锛�","瀵嗙骇锛�"};
+ ArchiveRecords ard = iArchiveRecordsService.selectArchiveRecordsById(id);
+
+
+ String formattedDate = "";
+ if(ard.getPreparationDate()!=null) {
+ LocalDate date = ard.getPreparationDate().toInstant()
+ .atZone(ZoneId.systemDefault())
+ .toLocalDate();
+ ;
+ System.out.println("褰撳墠鏃ユ湡: " + date);
+
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ formattedDate = date.format(formatter);
+ }
+
+ String [] cons = {ard.getRecordId(),ard.getArchiveRoomNumber(),ard.getMicrofilmNumber(),ard.getInquiryNumber(),ard.getCaseTitle(),formattedDate,ard.getPreparationUnit(),
+ ard.getRetentionPeriod(),ard.getSecurityClassification()};
//鎶婂浘鐗囧姞鍏ュ埌pdf褰撲腑
Image img = Image.getInstance(createQrCodeN(cons[0], 80, 80));
@@ -504,7 +605,7 @@
float[] columnWidths = {35f, 65f}; // 绗竴鍒�30%锛岀浜屽垪70%
PdfPTable table = new PdfPTable(columnWidths);
// PdfPTable table = new PdfPTable(2);
- table.setWidthPercentage(80); // 澧炲ぇ琛ㄦ牸瀹藉害鐧惧垎姣�
+ table.setWidthPercentage(78); // 鍑忓皬琛ㄦ牸瀹藉害鐧惧垎姣斾娇涓ゅ垪鏇寸揣鍑�
table.setHorizontalAlignment(Element.ALIGN_LEFT); // 璁剧疆琛ㄦ牸鏁翠綋灞呬腑
table.setSpacingBefore(30f); // 璁剧疆琛ㄦ牸鍓嶉棿璺�
table.setSpacingAfter(90f); // 璁剧疆琛ㄦ牸鍚庨棿璺�
@@ -528,12 +629,64 @@
+ // 鍏堣绠楁墍鏈夋爣棰樼殑鏈�闀块暱搴�
+ int maxTitleLength = 0;
+ for (String tit : tits) {
+ maxTitleLength = Math.max(maxTitleLength, tit.length()-1);
+ }
+
for(int i = 0; i < tits.length; i++) {
// 浣跨敤PdfPTable瀹炵幇绮剧‘瀵归綈
// 绗竴琛岋細妗e彿
- PdfPCell labelCell1 = new PdfPCell(new Phrase(tits[i], chineseFont));
- labelCell1.setHorizontalAlignment(Element.ALIGN_RIGHT); // 璁剧疆鍙冲榻�
+ // 瀹炵幇瀵归綈锛氬湪鏂囧瓧涔嬮棿濉厖绌烘牸锛屼娇鎵�鏈夋爣棰樻�婚暱搴︾浉鍚�
+ String originalText = tits[i];
+
+ // 璁$畻闇�瑕佹坊鍔犵殑绌烘牸鏁�
+ int spacesToAdd = maxTitleLength - originalText.length();
+
+ String formattedText = originalText;
+ if (spacesToAdd > 0) {
+ // 鍦ㄥ啋鍙峰墠鐨勬枃瀛椾箣闂村潎鍖�鍒嗛厤濉厖绌烘牸
+ if (originalText.contains("锛�")) {
+ int colonIndex = originalText.indexOf("锛�");
+ String textBeforeColon = originalText.substring(0, colonIndex);
+ String textAfterColon = originalText.substring(colonIndex);
+
+ // 濡傛灉鍐掑彿鍓嶅彧鏈変竴涓瓧绗︼紝鐩存帴鍦ㄥ悗闈㈠姞绌烘牸
+ if (textBeforeColon.length() == 1) {
+ String fullWidthSpaces = StringUtils.repeat("銆�", spacesToAdd);
+ formattedText = textBeforeColon + fullWidthSpaces + textAfterColon;
+ } else if (textBeforeColon.length() > 1) {
+ // 鍦ㄦ枃瀛椾箣闂村潎鍖�鍒嗛厤绌烘牸
+ StringBuilder sb = new StringBuilder();
+ int chars = textBeforeColon.length();
+ int spacesPerGap = spacesToAdd / (chars - 1);
+ int extraSpaces = spacesToAdd % (chars - 1);
+
+ for (int j = 0; j < chars; j++) {
+ sb.append(textBeforeColon.charAt(j));
+ if (j < chars - 1) {
+ // 娣诲姞鍩烘湰绌烘牸
+ sb.append(StringUtils.repeat("銆�", spacesPerGap));
+ // 鍒嗛厤鍓╀綑绌烘牸
+ if (j < extraSpaces) {
+ sb.append("銆�");
+ }
+ }
+ }
+ sb.append(textAfterColon);
+ formattedText = sb.toString();
+ }
+ } else {
+ // 濡傛灉娌℃湁鍐掑彿锛岀洿鎺ュ湪鏈熬鍔犵┖鏍硷紙搴旇涓嶄細鍑虹幇杩欑鎯呭喌锛�
+ String fullWidthSpaces = StringUtils.repeat("銆�", spacesToAdd);
+ formattedText = originalText + fullWidthSpaces;
+ }
+ }
+
+ PdfPCell labelCell1 = new PdfPCell(new Phrase(formattedText, chineseFont));
+ labelCell1.setHorizontalAlignment(Element.ALIGN_RIGHT); // 鍗曞厓鏍煎彸瀵归綈
labelCell1.setBorder(Rectangle.NO_BORDER);
// PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont));
@@ -542,17 +695,18 @@
labelCell1.setPaddingTop(10f); // 涓婂唴杈硅窛10鍗曚綅
labelCell1.setPaddingBottom(10f); // 涓嬪唴杈硅窛10鍗曚綅
labelCell1.setPaddingLeft(15f); // 宸﹀唴杈硅窛15鍗曚綅
- labelCell1.setPaddingRight(15f); // 鍙冲唴杈硅窛15鍗曚綅
+ labelCell1.setPaddingRight(0f); // 鍙冲唴杈硅窛15鍗曚綅
PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont));
valueCell1.setBorder(Rectangle.NO_BORDER);
- valueCell1.setUseBorderPadding(true);
+ valueCell1.setUseBorderPadding(false); // 绂佺敤杈规鍐呰竟璺濊绠�
valueCell1.setBorderWidthBottom(0.5f); // 璁剧疆搴曢儴杈规浣滀负涓嬪垝绾�
valueCell1.setMinimumHeight(30);
valueCell1.setPaddingTop(10f); // 涓婂唴杈硅窛10鍗曚綅
valueCell1.setPaddingBottom(10f); // 涓嬪唴杈硅窛10鍗曚綅
- valueCell1.setPaddingLeft(15f); // 宸﹀唴杈硅窛15鍗曚綅
+ valueCell1.setPaddingLeft(0f); // 宸﹀唴杈硅窛0鍗曚綅
+ valueCell1.setExtraParagraphSpace(0f); // 绉婚櫎娈佃惤棰濆绌洪棿
valueCell1.setPaddingRight(15f); // 鍙冲唴杈硅窛15鍗曚綅
table.addCell(labelCell1);
table.addCell(valueCell1);
@@ -567,7 +721,7 @@
PdfPCell pdfPCell1 = new PdfPCell(img1);
pdfPCell1.setBorder(Rectangle.NO_BORDER); // 绉婚櫎鍗曞厓鏍艰竟妗�
- pdfPCell1.setMinimumHeight(40);
+ pdfPCell1.setMinimumHeight(20);
pdfPCell1.setUseAscender(true); // 璁剧疆鍙互灞呬腑
pdfPCell1.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 璁剧疆姘村钩灞呬腑
pdfPCell1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 璁剧疆鍨傜洿灞呬腑
--
Gitblit v1.9.1