生成工资单pdf签名
This commit is contained in:
parent
7b3f7b2e39
commit
12480f8306
|
|
@ -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
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue