Welcome Guest Search | Active Topics | Sign In | Register

How to write debug console log with HtmlToPdfSession Options
Michiel Reuser
Posted: Friday, June 27, 2025 8:42:25 AM
Rank: Newbie
Groups: Member

Joined: 1/23/2019
Posts: 3
We use HtmlToPdfSession to convert a web page to PDF. We want to get the webview console logs written into a file, so that we can diagnose javascript errors in the web page. We see there is a DebugOption to write console logs with HtmlToPdf:

Code: C#
using (StreamWriter consoleLogFileWriter = new StreamWriter(Path.Combine(debugConsolePath, debugConsoleFileName)))
{
    consoleLogFileWriter.AutoFlush = true;
    HtmlToPdf.DebugConsole = consoleLogFileWriter;
    HtmlToPdf.ConvertUrl(printURL, doc);
}

However, there is no DebugOption in HtmlToPdfSession. How can we write debug console logs when using HtmlToPdfSession?
eo_support
Posted: Friday, June 27, 2025 9:32:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,383
Hi,

HtmlToPdf.DebugConsole is a static member that applies to all HTML to PDF sessons. So you can just set it once at the begining of your application. It is not possible for you to have separate console logs through HtmlToPdf.DebugConsole.

If you wish to trace each conversion's console log separately, you would do it through the underlying WebView object's ConsoleMessage event similar to the sample code we provided for handling WebView.BeforeRequestLoad for the cache issue.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.