Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fixes on wkhtmltopdf

Michael Peter Christenc3c2b6999b78
diff --git a/htroot/api/snapshot.java b/htroot/api/snapshot.java
index 802d037e8..789acc476 100644
--- a/htroot/api/snapshot.java
+++ b/htroot/api/snapshot.java
@@ -144,7 +144,7 @@ public class snapshot {
if (!authenticated) return null;
SolrDocument sd = sb.index.fulltext().getMetadata(durl.hash());
SolrInputDocument sid = sb.index.fulltext().getDefaultConfiguration().toSolrInputDocument(sd);
- boolean success = Transactions.store(sid, true, true, sb.getConfigBool("isTransparentProxy", false) ? "http://127.0.0.1:" + sb.getConfigInt("port", 8090) : null, ClientIdentification.yacyProxyAgent);
+ boolean success = Transactions.store(sid, true, true, sb.getConfigBool("isTransparentProxy", false) ? "http://127.0.0.1:" + sb.getConfigInt("port", 8090) : null, ClientIdentification.yacyProxyAgent, sb.getConfig("crawler.http.acceptLanguage", null));
if (success) {
pdfSnapshots = Transactions.findPaths(durl, "pdf", Transactions.State.INVENTORY);
if (pdfSnapshots.size() != 0) pdfFile = pdfSnapshots.iterator().next();
diff --git a/source/net/yacy/cora/util/Html2Image.java b/source/net/yacy/cora/util/Html2Image.java
index 3b85e4489..f9aaf3948 100644
--- a/source/net/yacy/cora/util/Html2Image.java
+++ b/source/net/yacy/cora/util/Html2Image.java
@@ -78,11 +78,11 @@ public class Html2Image {
* @param destination
* @return
*/
- public static boolean writeWkhtmltopdf(String url, String proxy, String userAgent, File destination) {
- boolean success = writeWkhtmltopdfInternal(url, proxy, destination, null, true);
+ public static boolean writeWkhtmltopdf(String url, String proxy, String userAgent, final String acceptLanguage, File destination) {
+ boolean success = writeWkhtmltopdfInternal(url, proxy, destination, null, acceptLanguage, true);
if (!success && proxy != null) {
ConcurrentLog.warn("Html2Image", "trying to load without proxy: " + url);
- success = writeWkhtmltopdfInternal(url, null, destination, userAgent, true);
+ success = writeWkhtmltopdfInternal(url, null, destination, userAgent, acceptLanguage, true);
}
if (success) {
ConcurrentLog.info("Html2Image", "wrote " + destination.toString() + " for " + url);
@@ -92,12 +92,13 @@ public class Html2Image {
return success;
}
- private static boolean writeWkhtmltopdfInternal(String url, String proxy, File destination, String userAgent, boolean ignoreErrors) {
+ private static boolean writeWkhtmltopdfInternal(final String url, final String proxy, final File destination, final String userAgent, final String acceptLanguage, final boolean ignoreErrors) {
final File wkhtmltopdf = wkhtmltopdfMac.exists() ? wkhtmltopdfMac : wkhtmltopdfDebian;
String commandline =
- wkhtmltopdf.getAbsolutePath() + " -q --title " + url +
- (userAgent == null ? "" : "--custom-header 'User-Agent' '" + userAgent + "' --custom-header-propagation") +
- (proxy == null ? " " : " --proxy " + proxy + " ") +
+ wkhtmltopdf.getAbsolutePath() + " -q --title " + url + " " +
+ //acceptLanguage == null ? "" : "--custom-header 'Accept-Language' '" + acceptLanguage + "' " +
+ (userAgent == null ? "" : "--custom-header 'User-Agent' '" + userAgent + "' --custom-header-propagation ") +
+ (proxy == null ? "" : "--proxy " + proxy + " ") +
(ignoreErrors ? (OS.isMacArchitecture ? "--load-error-handling ignore " : "--ignore-load-errors ") : "") +
url + " " + destination.getAbsolutePath();
try {