Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Download PDF will show a new window

Post Reply
KessiJones
Posts: 5
Joined: Wed Apr 28, 2021 12:05 pm

Download PDF will show a new window

Post 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 ?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Download PDF will show a new window

Post 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.
Post Reply