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

Text layer moves up during search #5355

Closed
Rob--W opened this issue Sep 28, 2014 · 2 comments · Fixed by #5356
Closed

Text layer moves up during search #5355

Rob--W opened this issue Sep 28, 2014 · 2 comments · Fixed by #5356

Comments

@Rob--W
Copy link
Member

Rob--W commented Sep 28, 2014

  1. Visit the following PDF (http://movelex.hu/fenyoapa/tori_6_tk_webre.pdf_150.pdf) with the text layer enabled, e.g. using the URL parameter:http://movelex.hu/fenyoapa/tori_6_tk_webre.pdf_150.pdf#textLayer=visible
  2. Look at the text below the top-left image (looks all right).
    pdfjs-textlayer
  3. Use the search box and search for "pesti".
  4. Look at the text below the top-left image, and observe that the text layer has shifted up.
    pdfjs-textlayer-search

I've found this bug and PDF at https://stackoverflow.com/questions/25922247/how-to-fix-pdf-js-find-highlight-error-or-what-causes-it.

@Rob--W
Copy link
Member Author

Rob--W commented Sep 28, 2014

The shifting is caused by the invocation of scrollIntoView in TextLayerBuilder.renderMatches. The bug is caused by the fact that the PDF document contains text outside the visible view of the page (which becomes obvious if you add overflow:visible to the textLayer):

pdfjs-overflow

A way to work around the issue is to skip elements whose overflow attribute is set to hidden, which I've done in the next patch. Even though the patch resolves the issue, I wonder why we have text outside the page's view at all.

@Hengjie
Copy link
Contributor

Hengjie commented Jan 4, 2015

Perhaps we should prevent an element to be added if they exist outside of the textLayer's dimensions.

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

Successfully merging a pull request may close this issue.

3 participants