Page 1 of 1

Download PDF will show a new window

Posted: Mon May 17, 2021 1:00 pm
by KessiJones
Hello,

i try to download a PDF file from my webMail-App to preview.
I use the Mainb- and SubProcess-Logic.
the following is my StartCode in the Main-DPR and the same in the SubPRocess-DPR, but with StartSubProcess instead of StartMainProcess

Code: Select all

    GlobalCEFApp := TCefApplication.Create;
    GlobalCEFApp.FrameworkDirPath := 'CEF4Runtime32';
    GlobalCEFApp.ResourcesDirPath := 'CEF4Runtime32';
    GlobalCEFApp.LocalesDirPath := 'CEF4Runtime32\locales';
    GlobalCEFApp.SitePerProcess := False;
    GlobalCEFApp.EnableMediaStream := False;
    GlobalCEFApp.EnableSpeechInput := False;
    GlobalCEFApp.EnableHighDPISupport := False;
    GlobalCEFApp.DisableSpellChecking := True;
    GlobalCEFApp.EnablePrintPreview := True;
    GlobalCEFApp.DisablePDFExtension := True;
    GlobalCEFApp.EnableGPU := True;
    GlobalCEFApp.AddCustomCommandLine('--force-device-scale-factor', '0.85');
    GlobalCEFApp.BrowserSubprocessPath := 'MyBrowser.exe';
    GlobalCEFApp.StartMainProcess;
the functions Chromium1BeforeDownload and Chromium1DownloadUpdated are similar to the functions in the MiniBrowser-Demo.
But in My WebMailer if i click the preview-Button a new Windows appears and the download starts, but the new windows won't disappear.

May you help please ?

Re: Download PDF will show a new window

Posted: Mon May 17, 2021 1:17 pm
by salvadordf
Hi,

I'm afraid you have to close it manually from the code of your application. As far as I know, Chromium will not close it automatically.

I would suggest that you handle the new popup windows with Delphi/Lazarus forms instead of letting CEF create them automatically. That way you can control them better.

You can use the code in the PopupBrowser2 demo to know how to handle popup windows.