This commit is contained in:
linfso 2024-05-09 12:23:59 +08:00
parent a43dcc8347
commit b16778e546

View File

@ -126,9 +126,10 @@ public class TanexTplPrintImpl extends XddBasePrint {
ClassPathResource classPathResource = new ClassPathResource(tplName); ClassPathResource classPathResource = new ClassPathResource(tplName);
InputStream tplInStream = classPathResource.getInputStream(); InputStream tplInStream = classPathResource.getInputStream();
// InputStream tplInStream = new FileInputStream(new File(tplName)); // InputStream tplInStream = new FileInputStream(new File(tplName));
// 生成pdf文件
genPdfByTpl(getItemCelconfig(orderMap),tplInStream,os);
return ar; return ar;
} }
@ -201,9 +202,17 @@ public class TanexTplPrintImpl extends XddBasePrint {
order.put("parcel_qty", "1"); order.put("parcel_qty", "1");
order.put("create_day", "2023-12-30"); order.put("create_day", "2023-12-30");
ByteArrayOutputStream os = new ByteArrayOutputStream();
IXddTplPrint xtp = new TanexTplPrintImpl(); IXddTplPrint xtp = new TanexTplPrintImpl();
// xtp.genPDF(order,out); xtp.genPDF(order,os);
xtp.genPNG(order,out); // xtp.genPNG(order,os);
// 生成pdf base64
byte[] pdfBytes = os.toByteArray();
String pdfBase64Str = Base64.getEncoder().encodeToString(pdfBytes);
System.out.println(pdfBase64Str);
// xtp.genPNGBase64(order); // xtp.genPNGBase64(order);
} }