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 overlays over the PDF. Does anyone know if there's a good way to do this in Electron?

Answers:

Answer

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 = new BrowserWindow({
    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

Answer

You should checkout gerhardberger's electron-pdf-window

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.