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

Support searching in native PDF rendering #9030

Open
rreimann opened this issue Mar 27, 2017 · 11 comments
Open

Support searching in native PDF rendering #9030

rreimann opened this issue Mar 27, 2017 · 11 comments

Comments

@rreimann
Copy link
Contributor

@rreimann rreimann commented Mar 27, 2017

Electron 1.6.4 beta added support for native PDF rendering #8435

It would be nice if the native PDF viewer would support text searches via CmdOrCtrl+F keyboard shortcut like it does in Chromium.

@kevinsawicki kevinsawicki changed the title Feature request: support searching in native PDF rendering Support searching in native PDF rendering Mar 31, 2017
@deepak1556 deepak1556 self-assigned this Apr 17, 2017
@rreimann
Copy link
Contributor Author

@rreimann rreimann commented May 8, 2017

@deepak1556 is there a way to disable or suppress the native plugin?

I need to stick to PDF.js as long as advanced features like searching an printing are not supported by the plugin but triggering PDF.js via will-download handler doesn't work anymore since the plugin is on by default and seems to prevent will-download events from being fired.

@deepak1556
Copy link
Member

@deepak1556 deepak1556 commented May 8, 2017

is there a way to disable or suppress the native plugin?

There is no way to disable the plugin, but you can workaround it either by using iframes to display the pdf resource where will-download event will fire or you can intercept chrome protocol chrome://pdf-viewer/index.html?src=<original pdf uri> and render with pdf.js.

@rreimann
Copy link
Contributor Author

@rreimann rreimann commented May 9, 2017

Thanks for the suggestions but i had no luck in applying them in my scenario. Can you think of a workaround that works where the PDF should render in a new BrowserWindow while the contents of the main BrowserWindow keeps intact?

  • i can't introduce iframes for all the places in the application that might contain links to a PDF document.
  • i tried to cancel requests to chrome://pdf-viewer/index.html... in onBeforeRequest but that seems to be to late in the game to preserve the main window. I can open a new window that renders fine with pdf.js but the content of the main window vanishes.
  • i don't see a method in protocol that would let me intercept the chrome scheme in a way that i could render the PDF in a new window instead of just redirecting the existing main window.

@deepak1556
Copy link
Member

@deepak1556 deepak1556 commented May 9, 2017

Can you think of a workaround that works where the PDF should render in a new BrowserWindow while the contents of the main BrowserWindow keeps intact?

Its not possible with the current implementation. Fixing #9412 should provide a way for your scenario.

@codebytere
Copy link
Member

@codebytere codebytere commented May 9, 2018

This appears to have been made possible by #9507, so i'm going to go ahead and close this.

@codebytere codebytere closed this May 9, 2018
@rreimann
Copy link
Contributor Author

@rreimann rreimann commented May 9, 2018

@codebytere could you please reopen the issue? #9507 does not address the missing search support in any way.

@deepak1556 deepak1556 reopened this May 9, 2018
@leonheess
Copy link

@leonheess leonheess commented May 21, 2018

Please add this!

@deepak1556 deepak1556 removed their assignment Aug 28, 2018
@JonMarbach
Copy link

@JonMarbach JonMarbach commented Sep 20, 2018

Electron's native PDF support is pretty sweet! But searching in a PDF is really fundamental to the PDF experience... @deepak1556 What would it take to get this added?

@thibaultmol
Copy link

@thibaultmol thibaultmol commented Jan 13, 2021

Now that Obsidian has implemented proper PDF embedding in their notes, the main thing that's missing is still this issue of being able to search in pdfs. This a very critical part!

@rushikb
Copy link

@rushikb rushikb commented Jan 18, 2021

Hardest possible plus one to @thibaultmol 's point— Being able to search for PDF's will basically win you the swarm of people currently trying to escape the all consuming disaster that is evernote 10

@mochsner
Copy link

@mochsner mochsner commented Oct 13, 2021

Yeah so this is something that I find pretty necessary for a Native app (ish) based in Electron.

I'm currently running into this as a limitation for an app I use (Obsidian), but for something at my own maintained code at work, I've thought about looking into and migrating to Electron for the "native" experience it would give our users. Why would I want to migrate our web app to Electron if my app uses PDFs and that experience isn't complete? I can't think of a single PDF viewer that doesn't have this, except Electron. All modern browsers have much better PDF experiences, or otherwise plugins that enable it within the environment. Electron doesn't have that, so I've now found a caveat to an issue we'd run into with using Electron.

I can think of some code to potentially "launch PDF in ____ program" within the application code, but that feels a bit wrong for something that should have more of a "native app" feel like Electron, doesn't it? It's a good option for Obsidian, but I feel Electron should have this functionality considering Chromium does (albeit seemingly outside of the PDF viewer code).

In any case, does Electron have any sort of plugin type community that this could potentially be implemented by, if open source contributors were interested in creating this functionality? Whether or not, if anyone (maintainer, developer, or outsider) has ideas of design for this, I think it's worth mapping out. It sounds like @deepak1556 might have some thoughts on this (but may lack time) - so if there's anything that you can drop in here Deepak, I think the community would be very happy to know what the options are!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants