added fail-over missing http proxy service (i.e. overload) and quiet

mode
pull/1/head
Michael Peter Christen 10 years ago
parent 25a64c51b3
commit 68b040e31e

@ -72,8 +72,16 @@ public class Html2Image {
* @return * @return
*/ */
public static boolean writeWkhtmltopdf(String url, String proxy, File destination) { public static boolean writeWkhtmltopdf(String url, String proxy, File destination) {
boolean success = writeWkhtmltopdfInternal(url, proxy, destination);
if (success) return true;
if (proxy == null) return false;
ConcurrentLog.warn("Html2Image", "trying to load without proxy: " + url);
return writeWkhtmltopdfInternal(url, null, destination);
}
private static boolean writeWkhtmltopdfInternal(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 + " ") + (OS.isMacArchitecture ? "--load-error-handling ignore " : "--ignore-load-errors ") + url + " " + destination.getAbsolutePath(); String commandline = wkhtmltopdf.getAbsolutePath() + " -q --title " + url + (proxy == null ? " " : " --proxy " + proxy + " ") + (OS.isMacArchitecture ? "--load-error-handling ignore " : "--ignore-load-errors ") + url + " " + destination.getAbsolutePath();
try { try {
List<String> message; List<String> message;
if (!usexvfb) { if (!usexvfb) {

Loading…
Cancel
Save