Jump to content
Sign in to follow this  
TreyUsesDelphi

Save edgebrowser new window as file

Recommended Posts

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

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 by programmerdelphi2k

Share this post


Link to post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×