download a PDF file

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

download a PDF file

Postby sirjo66 » Thu May 05, 2022 6:45 am

Hello :)
I'm using CefSharp.WinForms
I navigate to a page and then I click on a link for to download a PDF file.
I see that CefSharp open a built-in PDF viewer and I can do some actions. All OK.
But now I want to change this and I want to download this PDF file for then open it with my PDF reader.
So, I add
Code: Select all
settings.CefCommandLineArgs.Add("disable-pdf-extension", "1")

Well, now I implement IDownloadHandler class with Before and Updated events so I can save this PDF file where I want.
It works very well, PDF is downloaded correctly and I see it with other reader,
but my problem is that CefSharp open his reader and show me a window all white without nothing inside it, and the user needs to close it.
How can I do that this window don't open ??

Many thanks
Sergio
sirjo66
Newbie
 
Posts: 6
Joined: Wed Oct 23, 2019 7:24 am

Re: download a PDF file

Postby amaitland » Thu May 05, 2022 2:37 pm

You can hide and then subsequently close the popup when the download starts/finishes.

https://github.com/cefsharp/CefSharp/is ... -922401466
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: download a PDF file

Postby sirjo66 » Fri May 06, 2022 7:06 am

amaitland wrote:You can hide and then subsequently close the popup when the download starts/finishes.

https://github.com/cefsharp/CefSharp/is ... -922401466


Many many thanks, it works !!!

Sergio
sirjo66
Newbie
 
Posts: 6
Joined: Wed Oct 23, 2019 7:24 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 16 guests