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

Search-function in a pdf document not working #472

Open
rschaufe opened this issue Jan 20, 2025 · 15 comments
Open

Search-function in a pdf document not working #472

rschaufe opened this issue Jan 20, 2025 · 15 comments

Comments

@rschaufe
Copy link

We use SEB in a Moodle-quiz. In a question there is a link to a pdf-file. When you click the link the pdf shows in a separate window.
There is a search function. Unfortunately it is not working.
Normaly (in Windows) the word is highlighted an you can search the next entry. But on the macOS, no word is highlighted, no possibility to go to the next word.

Used the newest version 3.4.1 on two different devices.

@danschlet
Copy link
Member

danschlet commented Jan 20, 2025

I just confirmed that the search in PDF files in SEB for macOS 3.4.1 works in general with this PDF: https://safeexambrowser.org/presentations/HowTo_SEB2.0.pdf

  • Are you sure that the PDF you're trying it with contains text and not scanned bitmaps?

  • Also you have to make sure that SEB can use the modern WebView. If the classic WebView is used (you should see the deprecation message on the top of new browser windows), search in PDFs as far as I know doesn't work. Make sure your SEB settings or SEB integration is updated to allow using the modern WebView (see also here Old WebView for In-Moodle-Configuration #468 and search).

  • In general the PDF viewer in the embedded WebKit engine isn't that great. For best results and full feature compatibility it's probably currently better to use server-side PDF rendering with pdf.js. Some web document viewers like in Polybox use server-side pdf.js on Macs/iOS and the built-in pdf.js in Chromium-based browsers.

  • On iOS WKWebView/SEB currently doesn't support search in PDFs at all. Use server-side PDF rendering as mentioned above.

@rschaufe
Copy link
Author

Yes, I just got the answer that on a MacBook Air with Sonoma 14 it works. But obviously those users who reported the problem use an iPad.
Since we use Moodle without content filtering. I guess can't decide what WebView is used.

@rschaufe
Copy link
Author

Got another message from a student using Macbook Pro with Sonoma 14.6.1. that search doesn't work.
Now I am confused. Because I am not a Mac user, I have no idea how you can configure such a device.

@rschaufe
Copy link
Author

Another feedback from two students:

  1. MacBook Pro, macOS Monterey Version 12.7.6
  2. iMac, macOS Sequoia Version 15.2
    Search function doesn't work.

@danschlet
Copy link
Member

As I said before: It won't work if SEB is using the classic WebView. I will assume that's the problem there until someone provides me with a test link I can try it out myself.

I will close this issue otherwise.

@rschaufe
Copy link
Author

I don't know if classic WebView is used, how should I know? We use Moodle and therefore we don't have anything to do with the configuration.

And all the students that reported, use the same configuration file and the newest version of the SEB.

Since the Quiz with SEB is within our Moodle system I can't get you a direct access. You would have to log in our Moodle with your Switch EDU Id and then I could give you access.

@danschlet
Copy link
Member

I don't know if classic WebView is used, how should I know?
By reading the links I posted in my first answer.

Also it's always a good idea to send log files (as mentioned on our support page and in the template when you create an issue). It's mentioned in there which WebView is used and I might be able to find out why the search doesn't work.

But I'm happy to try to reproduce the issue (maybe next week, as i'm working on a release right now), you can send me more information like the link to your Moodle server to info at safeexambrowser dot org.

@rschaufe
Copy link
Author

I try to organize the logfiles.
I read the post of your link, but that post didn't give we a clue. The problem is that some students report that search works and some say it doesn't work. With the same seb config file from Moodle.
I would appreciate if you log into our Moodle with your edu id moodle.ost.ch.
Than I can give you access. - OK?

@danschlet
Copy link
Member

Ok, I logged into your Moodle.

@rschaufe
Copy link
Author

Der Zugang zum Moodle-Quiz ist:
https://moodle.ost.ch/mod/quiz/view.php?id=418905

@rschaufe
Copy link
Author

org.safeexambrowser.SafeExamBrowser 2025-01-29--09-43-13-387.log

Hier ein log file eines MacBook Air mit Sonoma 14.4

Hier funktioniert die Suche. Ich warte noch auf Rückmeldungen von Studierenden, wo es nicht funktioniert.

@danschlet
Copy link
Member

Did you see the disclaimer for text search in the browser (in the tooltip in Settings or in SEB for macOS Release Notes):

Added text search for web pages: Use the search icon in the browser window toolbar or cmd-F. This feature is not available in the full screen mode main window. Search in PDFs works only in modern WebView and macOS >=11 (currently not in iOS).

This would explain the cases where text search didn't work on Macs if those students were using an older macOS version than 11 Big Sur.

As mentioned, on iOS/iPadOS text search in PDFs currently doesn't work at all. I will file a feature request to Apple, but if they fix it, it will only work in new iOS versions. Until then you would need to use a server-side PDF renderer like pdf.js. We at ETH use Polybox, which is based on Own Cloud. That uses pdf.js on macOS/iOS for rendering PDFs and then text search always works. Maybe there is a pdf.js plugin for Moodle?

@rschaufe
Copy link
Author

rschaufe commented Feb 5, 2025

Yes, I think you got it.


_Added text search for web pages: Use the search icon in the browser window toolbar or cmd-F. This feature is not available in the full screen mode main window. Search in PDFs works only in modern WebView and macOS >=11 (currently not in iOS).

This would explain the cases where text search didn't work on Macs if those students were using an older macOS version than 11 Big Sur._

We need to make our students aware of this in the next exam session.

To put the files in an other place than in the Moodle course is not an option for us. So it seems, that we have to live with it.

Thank you.

@danschlet
Copy link
Member

danschlet commented Feb 5, 2025

I just did a quick search and it seems there was a pdf.js plugin for Moodle, which renders PDF files on the server (so search should work on all SEB platforms): https://moodle.org/plugins/mod_pdfjsfolder
Apparently this was not maintained for a long time, but there seems to be a newer version here: https://github.com/onyetapp/WORDPRESS-02-onyetmpdf

Also there is this PDF annotation plugin: https://moodle.org/plugins/mod_pdfannotator
I assume they are rendering PDF files also server-side, so maybe something to look into (even if you don't need annotations). Update: This Plugin seems to be a Moodle activity, so cannot be used as quiz type in Moodle quizzes.

I'm interested to find a Moodle workaround for this question, but don't have time right now to look into it myself, but maybe someone can give us input on this.

Also I will report the iOS PDF search issue to Apple and look into if SEB could add a better PDF view with search (but this would be more work and might take longer time).

@rschaufe
Copy link
Author

rschaufe commented Feb 9, 2025

I installed the plugin. But it only works with very small files. My idea was to implement a Moodle filter with pdf.js. But now I have to find out where the problem is with bigger files.

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

No branches or pull requests

2 participants