admin管理员组文章数量:1295874
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?
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?
Share asked Aug 25, 2017 at 5:04 David J.David J. 1,91313 gold badges52 silver badges100 bronze badges2 Answers
Reset to default 5If you're OK with UI provided by chrome PDF extension you can use it from electron.
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
and has been broken from 3.0.0
until 9.0.0
. (See this answer for details) For versions without support you can use electron-pdf-window
You should checkout gerhardberger's electron-pdf-window
本文标签: javascriptopening pdf files in electronStack Overflow
版权声明:本文标题:javascript - opening pdf files in electron - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741625954a2389081.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论