Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Selection jumps #62

Open
nmm opened this issue Jan 7, 2013 · 7 comments
Open

Selection jumps #62

nmm opened this issue Jan 7, 2013 · 7 comments

Comments

@nmm
Copy link

nmm commented Jan 7, 2013

Selection "jumps" when selecting multiple paragraphs( FF and Chrome).
Here is simple sample - try to select some of the internal paragraphs - the selections jumps and blinks.
https://www.dropbox.com/s/upc6tdbnzt3isvb/TestSimple.html

@coolwanglu
Copy link
Owner

The reason is that there is some distance between the letters. The distance is not literally a space ' ', just a positional shift.

It's a known issue, I cannot add a space there since otherwise if you copy & paste the text, you will see an extra space.

There are only 2 possible workarounds

  • specify a larger value for "--heps" might help, which would hurt accuracy however
  • handle selection with Javascript, say you recognize the selected part and draw a rectangle there -- which is beyond the scope of pdf2htmlEX

If you have better solutions, please tell me.

Marked this issue as "need solution"

@jahewson
Copy link
Contributor

I may have found a solution to this problem. Placing a non-absolutely positioned <div> at the start of the page fixes it:

<div id="pdf-main">
  <div class="d" style="width:595.320000px;height:841.920000px;">
    <div id="p1" data-page-no="1" class="p">
      <div class="b" style="background-image:url('data:image/png;base64,iVBORw0KGgoAA...5CYII=');background-position:0 0;background-size:595.320000px 841.920000px;background-repeat:no-repeat;">
      <div><!-- adding this empty div gives the page some non-absolute content--></div>
      <div style="left:70.824000px;bottom:760.780000px;" class="l t1 h0">
        <span class="f1 s1 c0 l0 w0 r0">Lorem ipsum...

Edit: actually I may have been confused about the original problem - this is a fix for flickering/blinking when changing the selection quickly, not jumping. Though the original post did mention that the selection "blinks".

@coolwanglu
Copy link
Owner

OK, I'll have a try

@coolwanglu
Copy link
Owner

I just tried the empty div trick, which didn't work on my machine (Linux +
Firefox 18.0.1)

On Thu, Jan 24, 2013 at 7:22 AM, John Hewson [email protected]:

I have found a solution to this problem. Placing a non-absolutely
positioned

at the start of the page fixes it:

  <div style="left:70.824000px;bottom:760.780000px;" class="l t1 h0">
    <span class="f1 s1 c0 l0 w0 r0">Lorem ipsum...


Reply to this email directly or view it on GitHubhttps://github.com//issues/62#issuecomment-12628602.

@jahewson
Copy link
Contributor

I was using Chrome 23 on OS X - it may be a Chrome bug...

@coolwanglu
Copy link
Owner

@nmm Can you please provide the original PDF?

@coolwanglu
Copy link
Owner

@jahewson Tried your solution on Chrome 26 + Windows, and it didn't work.
The selection blinks when the cursor is in the gap between two lines, i.e. the areas that are not occupied by the bounding box of the characters. At this point, Chrome would consider the selection ends to the beginning -- might be valid in some sense?

It might be solved with JavaScript, I guess. But I doubt if it will be worth it.

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

No branches or pull requests

3 participants