Commit f658cf32 LN

二维码打印修改。

1 个父辈 eaa8af9e
...@@ -77,6 +77,7 @@ public class QrcodeUtils { ...@@ -77,6 +77,7 @@ public class QrcodeUtils {
codeSize = codeSize - pageSpace * 2; codeSize = codeSize - pageSpace * 2;
int fontSize = settings.getFontSize(); int fontSize = settings.getFontSize();
fontSize=24;
int index = 0; int index = 0;
// 生成二维码图片 // 生成二维码图片
...@@ -108,10 +109,14 @@ public class QrcodeUtils { ...@@ -108,10 +109,14 @@ public class QrcodeUtils {
BaseFont baseFont = BaseFont.createFont("C:/WINDOWS/Fonts/simsun.ttc,1", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED); BaseFont baseFont = BaseFont.createFont("C:/WINDOWS/Fonts/simsun.ttc,1", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
boldFont = new Font(baseFont,fontSize); boldFont = new Font(baseFont,fontSize);
}catch (Exception e){ }catch (Exception e){
log.error("未找到字体simsun.ttc"); log.error("未找到字体simsun.ttc,使用默认字体");
// 使用默认字体,但增大字体大小
boldFont = new Font(Font.BOLD, fontSize + 2);
} }
PdfPTable table = new PdfPTable(2); // PdfPTable table = new PdfPTable(2);
PdfPTable table = new PdfPTable(1);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_CENTER);
if(baseColumnCount == 2){ if(baseColumnCount == 2){
table.getDefaultCell().setMinimumHeight(codeSize/4.3f); table.getDefaultCell().setMinimumHeight(codeSize/4.3f);
...@@ -119,10 +124,12 @@ public class QrcodeUtils { ...@@ -119,10 +124,12 @@ public class QrcodeUtils {
table.setSpacingBefore(15); table.setSpacingBefore(15);
} }
float[] columnWidths = { 0.6f, 1f}; // float[] columnWidths = { 0.6f, 1f};
float[] columnWidths = { 1f};
table.setWidths(columnWidths); table.setWidths(columnWidths);
table.addCell(new Phrase("Reel ID:", boldFont)); // table.addCell(new Phrase("Reel ID:", boldFont));
table.addCell(new Phrase(qrcodeContent, boldFont)); table.addCell(new Phrase(qrcodeContent, boldFont));
Barcode barcode = barcodeManager.findByBarcode(qrcodeContent); Barcode barcode = barcodeManager.findByBarcode(qrcodeContent);
...@@ -136,14 +143,14 @@ public class QrcodeUtils { ...@@ -136,14 +143,14 @@ public class QrcodeUtils {
desc = barcode.getMemo(); desc = barcode.getMemo();
} }
table.addCell(new Phrase("PN:", boldFont)); // table.addCell(new Phrase("PN:", boldFont));
table.addCell(new Phrase(partNumber,boldFont)); table.addCell(new Phrase(partNumber,boldFont));
table.addCell(new Phrase("QTY:",boldFont)); // table.addCell(new Phrase("QTY:",boldFont));
table.addCell(new Phrase(qty,boldFont)); table.addCell(new Phrase(qty,boldFont));
table.addCell(new Phrase("DESC:",boldFont)); // table.addCell(new Phrase("DESC:",boldFont));
table.addCell(new Phrase(desc,boldFont)); table.addCell(new Phrase(desc,boldFont));
// Paragraph paragraph = new Paragraph(textContent,font); // Paragraph paragraph = new Paragraph(textContent,font);
// paragraph.setAlignment(Element.ALIGN_LEFT); // paragraph.setAlignment(Element.ALIGN_LEFT);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!