Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Selection jumps #62

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

Comments

Projects
None yet
3 participants

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

Owner

coolwanglu commented Jan 8, 2013

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"

Contributor

jahewson commented Jan 23, 2013

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".

Owner

coolwanglu commented Jan 24, 2013

OK, I'll have a try

Owner

coolwanglu commented Jan 24, 2013

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 notifications@github.comwrote:

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/coolwanglu/pdf2htmlEX/issues/62#issuecomment-12628602.

Contributor

jahewson commented Jan 24, 2013

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

Owner

coolwanglu commented Mar 25, 2013

@nmm Can you please provide the original PDF?

Owner

coolwanglu commented May 6, 2013

@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 join this conversation on GitHub. Already have an account? Sign in to comment