TreyUsesDelphi 0 Posted May 18, 2023 I have an embedded edgebrowser in my application. I am using the edgebrowser to navigate to and log into different websites. Oftentimes, the websites will have links to pdf files that I want to download to a specific directory. I am trying to accomplish this by adding code to the EdgeBrowserNewWindowRequested event but I cannot seem to figure out a way to save the contents of the page to a file. What is the best way to download the pdf? Share this post Link to post
programmerdelphi2k 237 Posted May 18, 2023 (edited) by default, all files is downloaded on "Download" dir defined in browser setup (I think that It's not possible your requirement, for each file type, in case PDF) , you can try set the key on Registry. Then, it would can be used by Edge. HCU.... "Software\Microsoft\Edge\Main" if does not exists, create it! later, Reg.OpenKey('Software\Microsoft\Edge\Main', False); Reg.WriteString('Default Download Directory', 'D:\Your_New_Download_Dir_For_All_Files_Not_Only_PDF'); Edited May 18, 2023 by programmerdelphi2k Share this post Link to post
TreyUsesDelphi 0 Posted May 18, 2023 Thank you for your response. I looked at using javascript to download the file. The problem that I ran into was that I was restricted to saving the file to the downloads folder. In my application, I need to save the file to several different folders depending on the record being accessed. Changing the download directory will probably not work well. I suppose that I could make the download request, watch the download folder for the download to complete and then move the file to its intended destination. I was just hoping that there would be a simpler way to get it done. Share this post Link to post
programmerdelphi2k 237 Posted May 18, 2023 maybe you need "intercept" the download procedure and then re-direct it for you folder (for your type-file) Share this post Link to post