ElectronMail icon indicating copy to clipboard operation
ElectronMail copied to clipboard

PDF preview - content won't load

Open itisafrickinhighlander opened this issue 4 years ago • 17 comments

Opening PDF in the preview of ElectronMail will not load the content itself, only the header with a name of file, page identificator and download/close buttons. Preview of e.g. images works fine, so it looks like something specific to PDFs.

I can confirm FF or Chromium will show the content correctly, but both would use web version Beta35, so maybe a bug in Beta33?

itisafrickinhighlander avatar Feb 09 '21 12:02 itisafrickinhighlander

@electron has a known long-standing issue of displaying the PDF. I was subscribed to related issues and I've noticed they enabled some fixes. So if they fixed the issue then it will be respectively resolved in the next app release.

vladimiry avatar Feb 09 '21 12:02 vladimiry

The recent @electron 11.2.3 still affected. Going to test the case again during preparing new app release (hopefully this week).

vladimiry avatar Feb 09 '21 17:02 vladimiry

The app reports net::ERR_BLOCKED_BY_CLIENT error for the following requests when I click on invoce viewing link (which triggers modal with PDF in it):

  • chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/main.js
  • chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_viewer.js
  • chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.css

vladimiry avatar Feb 12 '21 20:02 vladimiry

Updated @electron / 11.1.0 => 12.0.0-beta.25 prints different error in comparison to the error posted in the previous message:

{
  errorCode: -6,
  errorDescription: 'ERR_FILE_NOT_FOUND',
  validatedURL: 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html',
  isMainFrame: true
}

vladimiry avatar Feb 16 '21 08:02 vladimiry

Hi @vladimiry, were there any updates on this on Electron side? Thanks!

Numline1 avatar Jan 12 '22 22:01 Numline1

The pdf viewing issue in @electron I believe was resolved a long time ago. The app still doesn't show the pdf so some debugging is supposed to be performed which I'm not planning to work on in the near future.

vladimiry avatar Jan 12 '22 22:01 vladimiry

No problem, thank you anyway :)

Numline1 avatar Jan 24 '22 16:01 Numline1

Hello @vladimiry, I have no problem previewing PDFs using <embed> on electron@^11.3.0.

KaKi87 avatar Jan 28 '22 11:01 KaKi87

@KaKi87 of course I've tried the very basic pure electron+pdf use case before and it worked. Apparently there are some specifics in the way @protonmail presents a pdf on the page. So my answer remains the same:

The app still doesn't show the pdf so some debugging is supposed to be performed which I'm not planning to work on in the near future.

vladimiry avatar Jan 28 '22 11:01 vladimiry

Ok, I've just tried to switch the app's webviews to a "persistent partition" mode and it worked (PDFs got displayed in the app). So it appears to be an upstream bug in @electron project.

The thing is that the app by design uses only in-memory partitions/sessions (a security/privacy matter), so switching to "persistent" ones is not going to happen. A possible workaround is patching the @protonmail code in order to make it use a custom pdf rendering (via PDF.js or similar stuff).

vladimiry avatar Jan 28 '22 13:01 vladimiry

I am experiencing this issue, on ElectronMail v5.1.5. Opening PDFs show a blank white screen -- top bar with filename, navigation, download, and close buttons are all visible. But not the PDF itself.

ghost avatar Mar 06 '23 18:03 ghost

Same issue here, v5.1.7.

javaduke avatar Apr 11 '23 21:04 javaduke

Are there any plans for fixing this issue? I'm on v5.1.8, and have several people using ElectronMail having to download all the PDFs we receive in order to view them.

ghost avatar Aug 17 '23 14:08 ghost

The fix should land on the @electron side. Only workaround could happen here, there is no ETA though.

vladimiry avatar Aug 17 '23 15:08 vladimiry

I'm not sure if I am reading this correctly, but it looks like the new PM desktop client uses ElectronMail https://github.com/ProtonMail/inbox-desktop and I have just recalled the PDF preview issue so I gave it a try and it worked. The upstream bug in Electron doesn't seem to be solved, though, so any idea if it can be caused by something else or it just can't be compared between EM and PM desktop client?

itisafrickinhighlander avatar Feb 07 '24 19:02 itisafrickinhighlander

@itisafrickinhighlander if you read the previous comments, you will see that the issue only takes place if the in memory partition type is used for the webview. Apparently it's not the case for PM desktop app.

The webview is used for multiple accounts support. I don't know if PM desktop app has multiple accounts support at this time.

The in memory partition type is used in the app in order to keep all the data in app's control vs letting default browser's storages to be persisted (it's likely done this way in PM desktop client).

So it's wrong to directly compare PM and EM apps, since the functionality and data persisting model are different. If PM app is a better fit for your needs, so let it serve you. I'm not going to make webview's partitions persisted, as in my opinion it weakens the data security. So, as described before, the PDF displaying issue has to be resolved at the @electron side.

vladimiry avatar Feb 07 '24 19:02 vladimiry