[Zotero 7 Beta] Problems with loading of PDF files in the Reader

The loading of PDF files has become slower and buggy in the latest beta.

Just after the text appears in the PDF Reader, it cannot be selected:
[JavaScript Error: "selectionRanges[0] is undefined" {file: "resource://zotero/reader/reader.js" line: 24635}]
In some cases, the right-click release to finish the text selection is not captured:
https://s3.amazonaws.com/zotero.org/images/forums/u265723/c9o4adoo7x2zomkzulmq.png

Sometimes the loading of the PDF content takes much longer than before. Even after waiting a long time, the text appears, but I still cannot do anything. I still need to wait another long time before text selection and annotations become possible.

If I try to scroll down in the PDF file during loading, at some point it suddenly goes back to the top of the PDF file.

Debug ID: D259828608
Zotero 7.0.0-beta.82+79fa160e4 (64-bit)
Windows 10
  • Could you send your slowest PDF file?
  • edited May 30, 2024
    Here is an open access example:
    Sneha Ravi, A., & Dalvi, S. (2024). Liquid Marbles and Drops on Superhydrophobic Surfaces: Interfacial Aspects and Dynamics of Formation: A Review. ACS Omega, 9(11), 12307–12330. https://doi.org/10.1021/acsomega.3c07657

    It seems to be related to the new figures and references extraction feature.
    This is consistent with the large number of linked figures (16) and references (238) in the paper above.

    It looks really nice!
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/86lx9ergy6ec8lp55zb1.png

    But it becomes a lot slower to load.
    It seems to load the pages by parts:
    During loading:
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/1ndtrdipjbitpsvniqkn.png
    After loading:
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/21lc6vs5ax2cgatftti0.png

    Another open access example that is really slow:
    Rosselló, J. M., Hoeppe, H. P., Koch, M., Lechner, C., Osterhoff, M., Vassholz, M., Hagemann, J., Möller, J., Scholz, M., Boesenberg, U., Hallmann, J., Kim, C., Zozulya, A., Lu, W., Shayduk, R., Madsen, A., Salditt, T., & Mettin, R. (2024). Jetting bubbles observed by x-ray holography at a free-electron laser: Internal structure and the effect of non-axisymmetric boundary conditions. Experiments in Fluids, 65(2), 20. https://doi.org/10.1007/s00348-023-03759-9
  • I can't reproduce that (on macOS). Does it still happen in the latest beta? If so does it happen with the original PDF.js version https://mozilla.github.io/pdf.js/web/viewer.html ?
  • edited May 31, 2024
    There are many steps that can be slow or unresponsive during the loading, so I will try to narrow down simple steps to reproduce.

    In the latest beta: 7.0.0-beta.83+066eda731 (64-bit).
    I open this file in Troubleshooting Mode with only one tab opened: https://doi.org/10.1007/s00348-023-03759-9
    I let it open for 5 minutes to make sure that there is nothing still loading or running and disable the automatic syncing.
    I click and hold on the scrollbar and make it move down to the end of the paper and up to the top of the paper again 10 times quickly before releasing the scrollbar.

    Then it stays in this state for more than 3 minutes:
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/z7aoxvfcgsdb86vd34u4.png
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/bd7dfcyeqmcd2wzkm421.png

    Do the same in PDF.js in Firefox, it recovers after only 7 seconds.

    Do the same in Adobe Acrobat Pro, it works perfectly: the content of the PDF file is always visible while scrolling down and up. Acrobat never hangs while displaying the content of the PDF file.
  • edited May 31, 2024
    If I try to scroll down in the PDF file during loading, at some point it suddenly goes back to the top of the PDF file.
    That part of the loading problems has been around for a few versions already. It just gets much worse combined with the other problems.

    See this screen recording as illustration.
    The only actions I am doing in there are from the mouse, and they are recorded on the right side. So nothing more than a double click to open the PDF file, scrolling, and then just wait.
    The jump to the page originally displayed occurs at 0:14, ignoring the scrolling that happened in between.

    I do not see the problem in PDF.js in Firefox.
  • edited May 31, 2024
    @martynas_b: And here is an illustration of these two problems:
    Just after the text appears in the PDF Reader, it cannot be selected
    In some cases, the right-click release to finish the text selection is not captured
    The screen recording shows all the clicks so that you can see the problems.

    You can also see a case where the text selection was successful, the highlight popup window appears briefly, and disappears (0:41).

    I do not see these problems in PDF.js in Firefox: text selection is working immediately after loading.
  • But aside from text selection, the overall page loading is the same or slower compared to PDF.js in Firefox? Especially if you scroll quickly through many pages?
  • edited May 31, 2024
    It is much slower in Zotero when doing many loadings in a row.

    Do you need some more examples than this one?
    https://forums.zotero.org/discussion/comment/464361/#Comment_464361
  • It takes for me about 1 second to completely to load the document (10.1007/s00348-023-03759-9) with text layer. Therefore I can't reproduce the issue so far. Can you test on Linux or macOS as well?
  • edited May 31, 2024
    I have tested on Ubuntu 24.04 LTS on a separate recent powerful workstation with the same library.
    For the simple test case I have described above, I get a score of 2 minutes 30 seconds on Ubuntu... so not much better than on Windows. Have you tried reproducing the detailed steps I have described (not just a simple loading)?

    Maybe a screen recording will help to illustrate the comparison? You can see the comparison with PDF.js in Firefox from 1:36.
  • edited May 31, 2024
    Thanks for the recordings. Could you also check what PDF.js logs into Tools → Developer → Error Console?
  • edited May 31, 2024
    I have also made the test in a VM on the Ubuntu 24.04 workstation:
    Zotero 7.0.0-beta.83+066eda731 (64-bit)
    Ubuntu 24.04 LTS
    Account containing only 3 items including the test case 10.1007/s00348-023-03759-9. Not synchronised.

    I got a score of 2 minutes 15 seconds on that test to load the text after moving down and up 10 times.

    Anyone else can test?
  • @martynas_b
    Could you also check what PDF.js logs into Tools → Developer → Error Console?
    Here it is:
    TypeError: originalPage.div.querySelector(...) is null
    _attachPage resource://zotero/reader/reader.js:27629
    reader.js:27631:17
    https://s3.amazonaws.com/zotero.org/images/forums/u265723/h9846zco04yy3opvsqrs.png

    Debug ID: D1998651631
  • Yes, I get that error from time to time as well, but it doesn't explain the performance issue.
  • This other thread sounds related:
    I cannot even select any text in the paper
    https://forums.zotero.org/discussion/114804/cannot-add-annotation-after-upgrading-the-newest-beta-version

    So hopefully someone else can bring more information on these serious loading problems...
  • @martynas_b: A strange observation... It seems that the loading of the PDF files is much faster when I am not in Troubleshooting Mode...
    Is there anything special about the Troubleshooting Mode that would interfere with the PDF loading process?
  • edited May 31, 2024
    Yes, Troubleshooting Mode (a.k.a. Safe Mode) disables hardware acceleration for graphics
    rendering. You wouldn’t want to use it for testing performance.
  • Thank you. Then the problem is solved.
    I can still trigger the problems above in normal mode, but not to a degree that is really problematic.
Sign In or Register to comment.