אשכול זה הועבר לארכיון. נא לשאול שאלה חדשה אם יש לך צורך בעזרה.
When searching a PDF, the number of matches found changes as you navigate
Sorry if this is the wrong forum for this, I wasn't sure if I should just open a bug directly. I didn't see anything relevant here https://bugzilla.mozilla.org/buglist.cgi?product=Firefox&component=PDF%20Viewer&bug_status=__open__ so I don't think this has been reported before. Although I'm not even sure if this is a bug.
When I open a PDF (20 pages) and use Ctrl-F to search for a word in the document, the count of matches shown is initially wrong (too few matches) and that count changes as I click "Find next occurrence". It will fluctuate as I navigate through the document, going up or down. In my example I don't believe it ever actually showed a correct number of matches for how many times the search term actually appears (based on searching with another PDF program)
Here are screenshots of my test PDF https://imgur.com/a/8voWxGb (note that the total count of matches fluctuates both up and down. the final page shows 31/31 when there should be actually 52 results)
The PDF in question (searching for "commitment") https://s3-us-west-2.amazonaws.com/gmtwebsiteassets/colonialtwilight/ColTwi-RULES-LR-May2018.pdf
This does not appear to be a problem in the "live demo" of pdf.js (for example searching for "trace") https://mozilla.github.io/pdf.js/web/viewer.html which is using a different search mechanism that doesn't appear in the built in PDF viewer in FF.
השתנתה ב־ על־ידי michiakig
כל התגובות (3)
Hi michiakig, my first thought was that Firefox sometimes delays converting part of the PDF to HTML. If I page down quickly in a long PDF, I can see that Firefox hasn't generated those pages yet and needs to do so. So I thought this might be related to why it is not aware of matches in later pages at the time you ran the Find. Although, why would the number of hits go down at any point? Hmm...
But then, I noticed my Find bar (Firefox 62 on Windows 7) doesn't show a hit count at all in the PDF Viewer. It is hidden. I don't know why yours is not hidden on Mac. ??
It could be some delay in parsing the PDF and generating HTML, but what makes me think this is a bug or otherwise broken feature is the way it works in pdf.js (which I believe Firefox has embedded as its PDF viewer). The Ctrl-F feature in that project's demo looks like it is overriding the Firefox find feature and it works exactly as you would expect. I've attached a screenshot to make that clearer.
השתנתה ב־ על־ידי michiakig
Hi michiakig, the demo is a pure web app with its own search logic. Unfortunately, that is stripped out when it is built into Firefox to maintain consistency with how Find works on other documents.
If I load a regular page first, open the Find bar and use Find, then load a PDF in that tab, the "1 of 11" count from the previous page continues to be displayed but isn't updated any more. So at least on my Firefox, it seems that the hit count is intentionally disabled in the PDF Viewer.
Not sure if this is an intentional Mac-Windows difference, but it makes it impossible to investigate on my system.