-
Notifications
You must be signed in to change notification settings - Fork 110
Logging
If you need to troubleshoot the IO access when downloading the images, you can either provide your own version of HtmlToOpenXml.IO.IWebRequest, either simply providing a ILogger implementation to the DefaultWebRequest.
// 1st parameter is the HttpClient ; null will use the default implementation.
HtmlConverter converter = new HtmlConverter(mainPart, new DefaultWebRequest(null, logger));
If you need to troubleshoot the conversion, it's possible to capture the silent error messages. This library use the classic tracing mechanism of .Net Framework. You can easily select where to store the log (flat file, xml file, console, ...) If you need further explanation how the tracing API works, you can consult this post on the BCL team blog.
In the app.config/web.config, add this snippet:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="html2openxml"
switchValue="Error">
<listeners>
<add name="text" type="System.Diagnostics.TextWriterTraceListener" initializeData="error.log" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
The switchValue can have these values:
Error: log any silent errors that occurs such as downloading images or reading base64 images.
Verbose: Error + processed tags