Disable PDF Viewer in Cefglue

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Disable PDF Viewer in Cefglue

Postby ITResearcher » Tue Sep 07, 2021 6:39 am

I am using cefglue in my app , I need to download the PDF file when pdf file link is opened. right now the pdf is opened in default pdf viewer plugin of cefglue via a new popup window.
My current cef settings are
Code: Select all
Dim cefSettings As New CefSettings()
    cefSettings.MultiThreadedMessageLoop = True
     cefSettings.CachePath = local_appdata_folder
    CefRuntime.Initialize(cefMainArgs, cefSettings, cefApp)


Is it possible to disable the pdf viewer in cefglue or is there any method to force pdf to download when link is clicked.
ITResearcher
Newbie
 
Posts: 6
Joined: Fri Jul 23, 2021 4:12 am

Re: Disable PDF Viewer in Cefglue

Postby magreenblatt » Tue Sep 07, 2021 7:23 am

Add "--disable-pdf-extension" on the command line.
magreenblatt
Site Admin
 
Posts: 12379
Joined: Fri May 29, 2009 6:57 pm

Re: Disable PDF Viewer in Cefglue

Postby ITResearcher » Thu Sep 09, 2021 12:08 am

I have sent the Argument via the cefMainArgs, is it right way? I am unable to disable the pdf viewer.
Please find the code below
Code: Select all
Public Shared Sub Main(ByVal args As String())
    Try

        If is_cef_glue = 1 Then
            CefRuntime.Load()
            Dim args2() As String = {"--disable-pdf-extension"}
            Dim cefMainArgs As New CefMainArgs(args2)
            Dim cefApp As New DemoCefApp()

            If CefRuntime.ExecuteProcess(cefMainArgs, cefApp) <> -1 Then
                Call msglog("CefRuntime could not the secondary process." & Space(10) & "program.Sub Main", False)
            End If

            Dim cefSettings As New CefSettings()
            cefSettings.MultiThreadedMessageLoop = True
            CefRuntime.Initialize(cefMainArgs, cefSettings, cefApp)

            Dim cefWindowInfo__1 As CefWindowInfo = CefWindowInfo.Create()

            Dim j As New CefRectangle(0, form_cef.fra_Cef_infobar.Height, My.Computer.Screen.Bounds.Width, My.Computer.Screen.WorkingArea.Height - form_cef.fra_Cef_infobar.Height - 25)
            cefWindowInfo__1.SetAsChild(form_cef.Handle, j)
            Dim cefBrowserSettings As New CefBrowserSettings()

            Dim cefClient As New DemoCefClient(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)

            CefBrowserHost.CreateBrowser(cefWindowInfo__1, cefClient, cefBrowserSettings, url)
            cefWindowInfo__1.Hidden = False
            form_cef.ShowDialog()

            CefRuntime.Shutdown()
        End If
    Catch ex As Exception
       
    End Try
End Sub
ITResearcher
Newbie
 
Posts: 6
Joined: Fri Jul 23, 2021 4:12 am

Re: Disable PDF Viewer in Cefglue

Postby ndesktop » Thu Sep 09, 2021 3:48 am

I think you should specify args2 as "disable-pdf-extensions", without the leading --.
ndesktop
Master
 
Posts: 748
Joined: Thu Dec 03, 2015 10:10 am

Re: Disable PDF Viewer in Cefglue

Postby ITResearcher » Thu Sep 09, 2021 4:09 am

I have tried with "disable-pdf-extension" it didn't help.
ITResearcher
Newbie
 
Posts: 6
Joined: Fri Jul 23, 2021 4:12 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 5 guests