Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Embedded PDF not displaying #33519

Closed
3 tasks done
jannis6023 opened this issue Mar 30, 2022 · 6 comments · Fixed by #33560
Closed
3 tasks done

[Bug]: Embedded PDF not displaying #33519

jannis6023 opened this issue Mar 30, 2022 · 6 comments · Fixed by #33560

Comments

@jannis6023
Copy link

Preflight Checklist

Electron Version

18.0.0

What operating system are you using?

macOS

Operating System Version

MacOS 12.3

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

PDF File should be displayed just like when opening the page in Chrome browser.

Actual Behavior

The PDF file isn't displayed in the Embed.
Screenshot:
Bildschirmfoto 2022-03-30 um 16 04 47
=> Error loading PDF document.

Testcase Gist URL

No response

Additional Information

I use this html for displaying it:
<embed type="application/pdf" src="https://....." style="width: 100%; height: 30rem;">
The document URL in here is a Blob URL with a PDF fetched from an internal API.

The window is loaded using this code:

const { app, BrowserWindow } = require('electron')
const createWindow = () => {
    const win = new BrowserWindow({
        width: 1400,
        height: 800,
        webPreferences: {
            plugins: true
        }
    })

    win.loadURL("https://127.0.0.1:8000/app")
}

app.whenReady().then(() => {
    createWindow()
})
@codebytere
Copy link
Member

Bisected to v18.0.0-alpha.5...v18.0.0-beta.1

@lishid
Copy link
Contributor

lishid commented Apr 11, 2022

I have encountered the same issue with PDF files loaded from blob: URLs and custom:// file protocols. I have not been able to use file:/// protocols because of web security ("Not allowed to load local resource").

Related issue: #24859

@lishid
Copy link
Contributor

lishid commented Apr 11, 2022

Hmmm just reading the PR in #33560 it doesn't sound like the patch actually closes this specific issue.

Addresses a failure introduced by CL:3501416, whereby if a PDF failed to load: [...]
and a user then clicked the Reload button, the following error would be seen in console:
[...]
Notes: Fixed an issue where the PDF Viewer would fail if a user attempted to reload.

I don't have a way to test this until it's released but hopefully it actually fixes the broken PDF viewer for blob: URLs (and not just the Reload button).

@codebytere
Copy link
Member

@lishid correct - it should be this one: #33664. I'll update the markings.

@sofianguy
Copy link
Contributor

Fixed #33664

@george-thomas-hill
Copy link

@sofianguy :

I'm still finding (in Electron 21.2.0) that loading a PDF in an iFrame fails to display the PDF, and loading a PDF in a webview crashes Electron.

Here's an Electron Fiddle gist that demonstrates this:

https://gist.github.com/george-thomas-hill/c3179e6eddeb1a2715201a20dbf95015

Could you please take another look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Fixed for Next Release
Development

Successfully merging a pull request may close this issue.

6 participants