Kyle Williamson
Kyle Williamson

Reputation: 2184

Remove the default DateTime stamp from header when printing from TEdgeBrowser

I am using the following code to control the header and footer text of a report printed from a TEdgeBrowser (see this answer). This works and allows me to add custom header and footer text. However, it also adds a DateTime stamp to the header of the report that I don't want to be shown. Is there a way to remove the default DateTime stamp from showing in the header when printing from a TEdgeBrowser? The custom header and footer still needs to be shown.

procedure TForm1.Button1Click(Sender: TObject);
var
  PrintSettings: ICoreWebView2PrintSettings;
begin
  (EdgeBrowser1.EnvironmentInterface as ICoreWebView2Environment6).CreatePrintSettings(PrintSettings);

  PrintSettings.Set_ShouldPrintHeaderAndFooter(true.ToInteger);
  PrintSettings.Set_HeaderTitle('New Header text');
  PrintSettings.Set_FooterUri('New Footer text');

  (EdgeBrowser1.DefaultInterface as ICoreWebView2_16).Print(PrintSettings, nil);
end;

I was able to achieve this with a TWebBrowser by changing Internet Explorer registry keys, however they don't seem to exist for Edge.

Upvotes: 3

Views: 183

Answers (0)

Related Questions