Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Add JavaScript-related options from WkHtmlToPdf #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Wkhtmltopdf.NetCore/Implementation/ConvertOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ConvertOptions : IConvertOptions
public ConvertOptions()
{
this.PageMargins = new Margins();
this.EnableJavaScript = true;
}

/// <summary>
Expand Down Expand Up @@ -97,6 +98,26 @@ protected string GetContentType()
/// </summary>
[OptionFlag("--footer-spacing")]
public int? FooterSpacing { get; set; }

/// <summary>
/// Do not allow web pages to run JavaScript
/// </summary>
/// <remarks>Disabled by default</remarks>
[OptionFlag("--disable-javascript")]
public bool DisableJavaScript { get; set; }

/// <summary>
/// Allow web pages to run JavaScript
/// </summary>
[OptionFlag("--enable-javascript")]
public bool EnableJavaScript { get; set; }

/// <summary>
/// Waits this number of milliseconds for JavaScript to finish executing
/// </summary>
/// <remarks>Default is 200ms</remarks>
[OptionFlag("--javascript-delay")]
public int? JavaScriptDelay { get; set; }

/// <summary>
/// Sets the variables to replace in the header and footer html
Expand Down Expand Up @@ -155,4 +176,4 @@ protected string GetConvertBaseOptions()
return result.ToString().Trim();
}
}
}
}