diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/resource/FSEntityResolver.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/resource/FSEntityResolver.java
index 898bbaa66..a76905bc2 100644
--- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/resource/FSEntityResolver.java
+++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/resource/FSEntityResolver.java
@@ -84,7 +84,7 @@ public InputSource resolveEntity(String publicID,
try {
is = realUrl.openStream();
} catch (IOException e) {
- e.printStackTrace();
+ XRLog.log(Level.WARNING, LogMessageId.LogMessageId1Param.EXCEPTION_IO_PROBLEM_FOR_URI, url, e);
}
if (is == null) {
diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/util/LogMessageId.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/util/LogMessageId.java
index 95ae21a3e..facbe410d 100644
--- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/util/LogMessageId.java
+++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/util/LogMessageId.java
@@ -149,6 +149,7 @@ enum LogMessageId1Param implements LogMessageId {
EXCEPTION_FONT_METRICS_NOT_AVAILABLE(XRLog.EXCEPTION, "Font metrics not available for font-description: {}"),
EXCEPTION_URI_SYNTAX_WHILE_LOADING_EXTERNAL_SVG_RESOURCE(XRLog.EXCEPTION, "URI syntax exception while loading external svg resource: {}"),
EXCEPTION_SVG_ERROR_HANDLER(XRLog.EXCEPTION, "SVG {}"),
+ EXCEPTION_SVG_CREATE_FONT(XRLog.EXCEPTION, "Error while creating a font with family: {}"),
EXCEPTION_PDF_IN_WRITING_METHOD(XRLog.EXCEPTION, "Exception in PDF writing method: {}"),
EXCEPTION_CANT_READ_IMAGE_FILE_FOR_URI(XRLog.EXCEPTION, "Can't read image file; unexpected problem for URI '{}'"),
EXCEPTION_CANT_READ_IMAGE_FILE_FOR_URI_NOT_FOUND(XRLog.EXCEPTION, "Can't read image file; image at URI '{}' not found"),
diff --git a/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/ForegroundPdfDrawer.java b/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/ForegroundPdfDrawer.java
index 72288a8f8..5dcebac28 100644
--- a/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/ForegroundPdfDrawer.java
+++ b/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/ForegroundPdfDrawer.java
@@ -3,6 +3,8 @@
import com.openhtmltopdf.extend.OutputDevice;
import com.openhtmltopdf.pdfboxout.PdfBoxOutputDevice;
import com.openhtmltopdf.render.RenderingContext;
+import com.openhtmltopdf.util.LogMessageId;
+import com.openhtmltopdf.util.XRLog;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSStream;
@@ -16,6 +18,7 @@
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Map;
+import java.util.logging.Level;
public class ForegroundPdfDrawer extends PdfDrawerBase
{
@@ -60,7 +63,7 @@ public Map drawObject(Element e, double x, double y, double width
}
catch (IOException e1)
{
- e1.printStackTrace();
+ XRLog.log(Level.WARNING, LogMessageId.LogMessageId1Param.GENERAL_MESSAGE, "Error while drawing with the ForegroundPdfDrawer ", e1);
}
return null;
}
diff --git a/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/MergeBackgroundPdfDrawer.java b/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/MergeBackgroundPdfDrawer.java
index 21548782e..8010dcaaa 100644
--- a/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/MergeBackgroundPdfDrawer.java
+++ b/openhtmltopdf-objects/src/main/java/com/openhtmltopdf/objects/pdf/MergeBackgroundPdfDrawer.java
@@ -5,7 +5,10 @@
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Map;
+import java.util.logging.Level;
+import com.openhtmltopdf.util.LogMessageId;
+import com.openhtmltopdf.util.XRLog;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSStream;
@@ -64,7 +67,7 @@ public Map drawObject(Element e, double x, double y, double width
}
catch (IOException e1)
{
- e1.printStackTrace();
+ XRLog.log(Level.WARNING, LogMessageId.LogMessageId1Param.GENERAL_MESSAGE, "Error while drawing with the MergeBackgroundPdfDrawer ", e1);
}
return null;
}
diff --git a/openhtmltopdf-svg-support/src/main/java/com/openhtmltopdf/svgsupport/OpenHtmlGvtFont.java b/openhtmltopdf-svg-support/src/main/java/com/openhtmltopdf/svgsupport/OpenHtmlGvtFont.java
index 10ae2fb9c..227d4805c 100644
--- a/openhtmltopdf-svg-support/src/main/java/com/openhtmltopdf/svgsupport/OpenHtmlGvtFont.java
+++ b/openhtmltopdf-svg-support/src/main/java/com/openhtmltopdf/svgsupport/OpenHtmlGvtFont.java
@@ -8,7 +8,10 @@
import java.io.File;
import java.io.IOException;
import java.text.CharacterIterator;
+import java.util.logging.Level;
+import com.openhtmltopdf.util.LogMessageId;
+import com.openhtmltopdf.util.XRLog;
import org.apache.batik.gvt.font.GVTFont;
import org.apache.batik.gvt.font.GVTFontFamily;
import org.apache.batik.gvt.font.GVTGlyphVector;
@@ -56,7 +59,7 @@ public OpenHtmlGvtFont(byte[] fontBytes, GVTFontFamily family, float size, Float
font = Font.createFont(Font.TRUETYPE_FONT, new ByteArrayInputStream(fontBytes)).deriveFont(toFontWeight(fontWeight) | toStyle(fontStyle) , size);
} catch (IOException e) {
// Shouldn't happen
- e.printStackTrace();
+ XRLog.log(Level.WARNING, LogMessageId.LogMessageId1Param.EXCEPTION_SVG_CREATE_FONT, family != null ? family.getFamilyName() : "", e);
font = null;
}