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?
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
You should checkout gerhardberger's electron-pdf-window
来源:https://stackoverflow.com/questions/45874719/opening-pdf-files-in-electron