生成工资单pdf签名

This commit is contained in:
钱涛 2023-09-18 18:45:59 +08:00
parent 7b3f7b2e39
commit 12480f8306
3 changed files with 145 additions and 89 deletions

View File

@ -0,0 +1,4 @@
genPdf=1
hasSign=1
toPdfToolPath=H:\\tools\\wkhtmltox\\bin\\wkhtmltopdf.exe
genPath=D:\\

File diff suppressed because one or more lines are too long

View File

@ -8,17 +8,15 @@ import java.io.File;
@Slf4j
public class HtmlToPdf {
// wkhtmltopdf在系统中的路径
private static final String toPdfTool = "H:\\tools\\wkhtmltox\\bin\\wkhtmltopdf.exe";
/**
* html转pdf
*
* @param toPdfTool 工具路径
* @param srcPath html路径可以是硬盘上的路径也可以是网络路径
* @param destPath pdf保存路径
* @return 转换成功返回true
*/
public static boolean convert(String srcPath, String destPath) {
public static boolean convert(String toPdfTool, String srcPath, String destPath) {
File file = new File(destPath);
File parent = file.getParentFile();
//如果pdf保存路径不存在则创建路径
@ -56,11 +54,4 @@ public class HtmlToPdf {
return result;
}
public static void main(String[] args) {
String sourcePath = "C:\\Users\\钱涛\\Desktop\\1(1).html";
HtmlToPdf.convert(sourcePath, "C:\\Users\\钱涛\\Desktop\\1.pdf");
System.out.println("0000");
}
}