|
|
@ -102,9 +102,11 @@ public class Html2Image {
|
|
|
|
(userAgent == null ? "" : "--custom-header 'User-Agent' '" + userAgent + "' --custom-header-propagation ") +
|
|
|
|
(userAgent == null ? "" : "--custom-header 'User-Agent' '" + userAgent + "' --custom-header-propagation ") +
|
|
|
|
(proxy == null ? "" : "--proxy " + proxy + " ") +
|
|
|
|
(proxy == null ? "" : "--proxy " + proxy + " ") +
|
|
|
|
(ignoreErrors ? (OS.isMacArchitecture ? "--load-error-handling ignore " : "--ignore-load-errors ") : "") +
|
|
|
|
(ignoreErrors ? (OS.isMacArchitecture ? "--load-error-handling ignore " : "--ignore-load-errors ") : "") +
|
|
|
|
"--footer-font-name 'Courier' --footer-font-size 9 --footer-left [webpage] --footer-right [date]/[time]([page]) " +
|
|
|
|
//"--footer-font-name 'Courier' --footer-font-size 9 --footer-left [webpage] --footer-right [date]/[time]([page]/[topage]) " +
|
|
|
|
|
|
|
|
"--footer-left [webpage] --footer-right [date]/[time]([page]/[topage]) " +
|
|
|
|
url + " " + destination.getAbsolutePath();
|
|
|
|
url + " " + destination.getAbsolutePath();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
ConcurrentLog.info("Html2Pdf", "creating pdf from url " + url + " with command: " + commandline);
|
|
|
|
List<String> message;
|
|
|
|
List<String> message;
|
|
|
|
if (!usexvfb) {
|
|
|
|
if (!usexvfb) {
|
|
|
|
message = OS.execSynchronous(commandline);
|
|
|
|
message = OS.execSynchronous(commandline);
|
|
|
@ -116,12 +118,12 @@ public class Html2Image {
|
|
|
|
commandline = "xvfb-run -a " + commandline;
|
|
|
|
commandline = "xvfb-run -a " + commandline;
|
|
|
|
message = OS.execSynchronous(commandline);
|
|
|
|
message = OS.execSynchronous(commandline);
|
|
|
|
if (destination.exists()) {usexvfb = true; return true;}
|
|
|
|
if (destination.exists()) {usexvfb = true; return true;}
|
|
|
|
ConcurrentLog.warn("Html2Image", "failed to create pdf " + (proxy == null ? "" : "using proxy " + proxy) + " and xvfb with command: " + commandline);
|
|
|
|
ConcurrentLog.warn("Html2Pdf", "failed to create pdf " + (proxy == null ? "" : "using proxy " + proxy) + " and xvfb with command: " + commandline);
|
|
|
|
for (String m: message) ConcurrentLog.warn("Html2Image", ">> " + m);
|
|
|
|
for (String m: message) ConcurrentLog.warn("Html2Image", ">> " + m);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
ConcurrentLog.warn("Html2Image", "exception while creation of pdf with command: " + commandline);
|
|
|
|
ConcurrentLog.warn("Html2Pdf", "exception while creation of pdf with command: " + commandline);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|