How to embed a pdf file in electron

2019-07-20 07:32发布

I'm using electron 3.0.0, and react. I need to show a pdf inside one of my react components. I've tried:

Electron PDF viewer

https://github.com/electron/electron/issues/11065

Unsuccessfully.

I used this 3 tags, none work

<object type="text/html" data={artist.getPdf()} width="100%" height="500" plugins="true"/>
<iframe src={artist.getPdf()} width="100%" height="500" />
<webview src={artist.getPdf()} plugins="true" width="100%" height="500"></webview>

All of this attempt to download the file, I just wanna show it inside a element.

In the electron.js file I put:

mainWindow = new BrowserWindow({
   ...
   webPreferences: {
     plugins: true
   }
})

0条回答
登录 后发表回答