Page 1 of 1

Disable PDF Viewer in Cefglue

PostPosted: Tue Sep 07, 2021 6:39 am
by ITResearcher
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.

Re: Disable PDF Viewer in Cefglue

PostPosted: Tue Sep 07, 2021 7:23 am
by magreenblatt
Add "--disable-pdf-extension" on the command line.

Re: Disable PDF Viewer in Cefglue

PostPosted: Thu Sep 09, 2021 12:08 am
by ITResearcher
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

Re: Disable PDF Viewer in Cefglue

PostPosted: Thu Sep 09, 2021 3:48 am
by ndesktop
I think you should specify args2 as "disable-pdf-extensions", without the leading --.

Re: Disable PDF Viewer in Cefglue

PostPosted: Thu Sep 09, 2021 4:09 am
by ITResearcher
I have tried with "disable-pdf-extension" it didn't help.