Commit 3e005221 by Simon Cheng

'薪资单PDF输出'

parent 0c070256
......@@ -22,16 +22,27 @@ public class PractitionerSalaryPDFTest {
//html模板文件
String tempFile = "practitionerSalaryTemplate.html";
//pdf输出文件
String outputFile = templatePDF + "sample.pdf";
//薪资单年月
String yearMonth = "202012";
//经纪人ID
String practitionerId = "17706";
//经纪人公司内部编号
String practitionerCode = "YDSH00134";
String outputFile = templatePDF + practitionerId + "Salary_" + yearMonth + "_"+ practitionerCode +".pdf";
//模板上的变量定义
Map<String, Object> variables = new HashMap<String, Object>(3);
Map<String, Object> dataVariables = new HashMap<String, Object>(3);
//初始化模板上变量值
initData(variables);
initData(dataVariables);
//使用模板文件填充数值后,生成html
String htmlStr = HtmlGenerator.generate(tempFile, variables);
String htmlStr = HtmlGenerator.generate(tempFile, dataVariables);
System.out.println(htmlStr);
//根据html生产PDF文件
OutputStream out = new FileOutputStream(outputFile);
//存放到OSS上,实例:
//https://yindun-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/payScale/20201207112601/17706Salary_202012_YDSH00134.pdf
PdfGenerator.generatePlus(htmlStr, out);
System.out.println(outputFile);
} catch (Exception ex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment