Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Selection jumps #62

nmm opened this Issue · 7 comments

3 participants

nmm commented

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.


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"


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


OK, I'll have a try


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


@nmm Can you please provide the original PDF?


@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
Something went wrong with that request. Please try again.