Skip to content

Commit

Permalink
Merge pull request #187 from jakubposkicom/command-line-switches
Browse files Browse the repository at this point in the history
Add several options useful for running on linux server for internal projects
  • Loading branch information
Sicos1977 authored Feb 12, 2025
2 parents c07b87a + c07403f commit 7eb9029
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ChromiumHtmlToPdfConsole/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,5 +431,23 @@ public class Options
/// </remarks>
[Option("enable-chromium-logging", Required = false, HelpText = "Enables Chromium logging; The output will be saved to the file chrome_debug.log in Chrome's user data directory. Logs are overwritten each time you restart Chromium")]
public bool EnableChromiumLogging { get; set; }

/// <summary>
/// Passes --disable-gpu to Chromium. This should be useful on common server hardware.
/// </summary>
[Option("disable-gpu", Required = false, HelpText = "Disables GPU hardware acceleration.")]
public bool DisableGpu { get; set; }

/// <summary>
/// Passes --ignore-certificate-errors to Chromium. Useful when generating from internal web server.
/// </summary>
[Option("ignore-certificate-errors", Required = false, HelpText = "Ignores certificate-related errors.")]
public bool IgnoreCertificateErrors { get; set; }

/// <summary>
/// Passes --disable-crash-reporter and --no-crashpad to Chromium.
/// </summary>
[Option("disable-crash-reporter", Required = false, HelpText = "Passes --disable-crash-reporter and --no-crashpad to Chromium.")]
public bool DisableCrashReporter { get; set; }
#endregion
}
12 changes: 12 additions & 0 deletions ChromiumHtmlToPdfConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ private static void SetConverterSettings(Converter converter, Options options)

if (options.EnableChromiumLogging)
converter.EnableChromiumLogging = true;

if (options.DisableGpu)
converter.AddChromiumArgument("--disable-gpu");

if (options.IgnoreCertificateErrors)
converter.AddChromiumArgument("--ignore-certificate-errors");

if (options.DisableCrashReporter)
{
converter.AddChromiumArgument("--disable-crash-reporter");
converter.AddChromiumArgument("--no-crashpad");
}
}
#endregion

Expand Down

0 comments on commit 7eb9029

Please sign in to comment.