Skip to content Skip to sidebar Skip to footer

Opening Pdf Files In Electron

I need to build an app where the user can open PDF files within the app -- i.e. not by opening a new browser window. I would need to implement a back button and possibly some over

Solution 1:

If you're OK with UI provided by chrome PDF extension you can use it from electron.

See this question

const {app, BrowserWindow} = require('electron')

app.once('ready', () => {
  let win = newBrowserWindow({
    webPreferences: {
      plugins: true
    }
  })
  win.loadURL(__dirname + '/test.pdf')
})

Note, that electron's native PDF support is available only since version 1.6.4. Before that you can use electron-pdf-window

Solution 2:

You should checkout gerhardberger's electron-pdf-window

Post a Comment for "Opening Pdf Files In Electron"