|
@@ -1,4 +1,4 @@
|
|
|
-package com.qmth.distributed.print.business.util.htmltopdf;
|
|
|
+package com.qmth.distributed.print.business.util;
|
|
|
|
|
|
import com.qmth.distributed.print.business.config.DictionaryConfig;
|
|
|
import com.qmth.distributed.print.business.enums.PageSizeEnum;
|
|
@@ -41,18 +41,12 @@ public class HtmlToPdfUtil {
|
|
|
DictionaryConfig dictionaryConfig = SpringContextHolder.getBean(DictionaryConfig.class);
|
|
|
cmd.append(dictionaryConfig.sysDomain().getHtmlToPdfUrl());
|
|
|
cmd.append(" ");
|
|
|
- cmd.append(" --page-size ").append(pageSizeEnum.name()).append(" ");// 打A3
|
|
|
-// cmd.append(" --margin-top 3cm ");
|
|
|
-// cmd.append(" --page-size A4 ");// 打A4
|
|
|
-// cmd.append(" --header-line");// 页眉下面的线
|
|
|
-// cmd.append(" --header-center 这里是页眉这里是页眉这里是页眉这里是页眉 ");//页眉中间内容
|
|
|
-// cmd.append(" --margin-top 3cm ");// 设置页面上边距 (default 10mm)
|
|
|
-// //cmd.append(" --header-html file:///" + "https://blog.csdn.net/x6582026/article/details/53835835");// (添加一个HTML页眉,后面是网址)
|
|
|
-// cmd.append(" --header-spacing 5 ");// (设置页眉和内容的距离,默认0)
|
|
|
-// cmd.append(" --footer-center 第[page]页/共[topage]页");//设置在中心位置的页脚内容
|
|
|
-// //cmd.append(" --footer-html file:///" + "https://blog.csdn.net/x6582026/article/details/53835835");// (添加一个HTML页脚,后面是网址)
|
|
|
-// cmd.append(" --footer-line");// * 显示一条线在页脚内容上)
|
|
|
-// cmd.append(" --footer-spacing 5 ");// (设置页脚和内容的距离)
|
|
|
+ cmd.append(" --page-size ").append(pageSizeEnum.name()).append(" ");
|
|
|
+ cmd.append(" --margin-top 0 ");
|
|
|
+ cmd.append(" --margin-bottom 0 ");
|
|
|
+ cmd.append(" --margin-left 0 ");
|
|
|
+ cmd.append(" --margin-right 0 ");
|
|
|
+
|
|
|
cmd.append(srcPath);
|
|
|
cmd.append(" ");
|
|
|
cmd.append(destPath);
|
|
@@ -61,13 +55,12 @@ public class HtmlToPdfUtil {
|
|
|
boolean result = true;
|
|
|
try {
|
|
|
Process proc = Runtime.getRuntime().exec(cmd.toString());
|
|
|
- new HtmlToPdfInterceptor(proc.getErrorStream()).start();
|
|
|
- new HtmlToPdfInterceptor(proc.getInputStream()).start();
|
|
|
proc.waitFor();
|
|
|
} catch (Exception e) {
|
|
|
log.error("请求出错", e);
|
|
|
result = false;
|
|
|
}
|
|
|
+ log.info("proc result:{}", result);
|
|
|
return result;
|
|
|
}
|
|
|
|