SafeExamBrowser / seb-mac

Safe Exam Browser for macOS and iOS
https://www.safeexambrowser.org/macosx
98 stars 40 forks source link

CMD+F search disabled in embedded PDF files, works in external PDF files #299

Open wilenius opened 1 year ago

wilenius commented 1 year ago

We just tested the search functionality in the latest seb-mac (3.2.4), MacOS version was 12.6.3.

When starting a Moodle Quiz SEB session, CMD+F works in the Quiz view. However, it does not work (no search results) in PDF files embedded to the Quiz (links starting with /pluginfile.php/(.*).pdf. Also, the search does not work in PDF files that are embedded on websites, which are linked to the quiz.

An example: The quiz has a link to the legislation collection https://eur-lex.europa.edu, which opens in a popup window. The PDF on that website opens, and the CMD+F search dialog opens, but no search results are displayed.

However, when a PDF is linked directly in the quiz, e.g., https://www.echr.coe.int/Documents/Convention_FIN.pdf, the search functionality works normally.

Search on embedded PDFs work in the Windows version, and they used to work in the Mac version too.

danschlet commented 1 year ago

Unfortunately Apple doesn't properly support search in PDFs in their web browser engine. Search in PDFs works only if SEB is using the modern WebView (depends on the SEB integration in the assessment/LMS solution, if pinch-to-zoom with two fingers on a trackpad works, then the modern WebView is used) and on macOS >=11 (currently not in iOS).

The issues with the search functionality you are mentioning are most likely caused by limitations of the browser engine we have to use in SEB for macOS and the differences how those PDF files are presented/embedded by the web application. Some web applications render PDF files themselves in HTML code, then the search functionality should work in any case.

It's extremely unlikely that a change in the SEB for Mac version caused the search to no longer work with PDF files, as we didn't change anything regarding this in its code. I would assume that a change in the web application caused this no longer to work in SEB for macOS.

I would look at this, but I would need testing access to your assessment system with some example quiz where I could reproduce these PDF issues.

wilenius commented 1 year ago

Thanks – I'll try to arrange a temporary user account for you. I assume that I can send the access info to your ETH email address?

danschlet commented 1 year ago

Yes, please do that.

danschlet commented 1 year ago

There was actually an issue in SEB 3.1 - 3.2.5 which prevented the text search to work in embedded PDF files. I fixed that in the beta of SEB 3.3 for macOS. Maybe you can test it and confirm if it works for you (I tested it on the https://eur-lex.europa.eu page).

javierravel commented 1 year ago

3.2.5 on macOS's last version. when opening a pdf that was uploaded to moodle, pressing CMD+F will open a search box but won't show results for the word searched.

notice the CMD+F work perfectly on the moodle's webpage itself.

that's a critical for our faculty law, which has lot of texts in exams.

danschlet commented 1 year ago

@javierravel Did you read the postings above?

NathanP23 commented 1 year ago

after enabling ”prefer modern” as a browser engine policy, the key now can’t be registered with our server beacause (quote) “Prefer Modern ignores the 'Use Browser & Config Keys'”

Is there another way to make searching in pdf work while still be able to register the key of the web file ?

javierravel commented 1 year ago

@danschlet Yes I saw I tried several versions and still the search on Mac does not work

danschlet commented 1 year ago

after enabling ”prefer modern” as a browser engine policy, the key now can’t be registered with our server beacause (quote) “Prefer Modern ignores the 'Use Browser & Config Keys'”

Is there another way to make searching in pdf work while still be able to register the key of the web file ?

No, your e-assessment solution needs to implement support for the SEB Javascript API to query the Browser and Config Keys, otherwise SEB cannot use the modern WebView and PDF search doesn't work. See the developer documentation page about this. Which assessment system or LMS are you using? Moodle for example has support built-in for this from version 4.1 and backported to the latest 4.0.x release. With older versions, you can install the updated Moodle SEB plugin manually, see SEB for macOS release notes for more information.

The only other way is to use some server-side PDF renderer like pdf.js which then offers search in PDFs.

NathanP23 commented 5 months ago

Did you mean that Moodle 4.1 and above have built-in support for modern webview ? if so, can I still use SEB with config keys ?

itamarm10 commented 4 months ago

Hello, has this issue been fixed by any chance? Is there a known way to fix this issue? My university uses SEB 3.3.1 and Moodle, and we still experience the issue with Cmd+F not working on Mac. Thanks!

danschlet commented 3 months ago

Please provide a test link/demo exam and instructions how to reproduce. For me searching in PDFs works (only on macOS, iOS/iPadOS unfortunately doesn't support that in the web browser engine we're using).

itamarm10 commented 2 weeks ago

@danschlet For the past months we have not been able to simulate a test to show the problem. However, it is possible to create a test that will work for 24 hours (perhaps a bit more). If that could work, we would very much like to coordinate a suitable time for you to check out the issue and we will prepare a test link when you're available. Thank you so much!