more logging when failing to create pdf snapshot

pull/1/head
Michael Peter Christen 10 years ago
parent 416fe886e3
commit 0119f8665d

@ -71,12 +71,15 @@ public class Html2Image {
*/ */
public static boolean writeWkhtmltopdf(String url, String proxy, File destination) { public static boolean writeWkhtmltopdf(String url, String proxy, File destination) {
final File wkhtmltopdf = wkhtmltopdfMac.exists() ? wkhtmltopdfMac : wkhtmltopdfDebian; final File wkhtmltopdf = wkhtmltopdfMac.exists() ? wkhtmltopdfMac : wkhtmltopdfDebian;
String commandline = wkhtmltopdf.getAbsolutePath() + " --title " + url + (proxy == null ? " " : " --proxy " + proxy + " ") + url + " " + destination.getAbsolutePath();
try { try {
OS.execSynchronous(wkhtmltopdf.getAbsolutePath() + " --title " + url + (proxy == null ? " " : " --proxy " + proxy + " ") + url + " " + destination.getAbsolutePath()); OS.execSynchronous(commandline);
return destination.exists(); if (destination.exists()) return true;
ConcurrentLog.warn("Html2Image", "failed to create pdf with command: " + commandline);
return false;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
ConcurrentLog.warn("Html2Image", "exception while creation of pdf with command: " + commandline);
return false; return false;
} }
} }

Loading…
Cancel
Save