4

This is an old bug, it seems to be not Evince's own fault but the bug is from Poppler. The specific cause of the bug has been identified (it's the calculation of some coordinates) but as of 2019 it is still not fixed in Ubuntu.

This is an example: I tried to highlight the second sentence of the first paragraph, but this is what I get: enter image description here

That means all the users of Ubuntu cannot highlight PDF texts using Evince --- this is such a basic function.

Is there any way to update Poppler to the correct version such that Evince works?

Please do not mark this as a duplicate question UNLESS one can provide a specific way to upgrade Poppler and resolve this problem.

Yan King Yin
  • 384
  • 2
  • 11
  • Can't reproduce this. In what conditions and with what type of document do you have the issue? – vanadium Apr 25 '19 at 06:21
  • @vanadium Added a picture. This is a PDF book I downloaded from the web. When I use a PDF I wrote myself, it seems to work correctly. But this problem happens with a lot of books I downloaded, I think it is very common. – Yan King Yin Apr 25 '19 at 12:54
  • 1
    These are probably PDF's which display bitmaps of the page, but contain OCR'ed text so the PDF can be searched. Please confirm and add info to the question. It is not that I know the solution, though. Just trying to get the question sharp. Does it work correctly in other viewers, or eventually in Acrobat in Windows or Mac? Might be a limitation of the format, and then there is little chance that Evince can be corrected. – vanadium Apr 25 '19 at 13:41
  • Thanks, you may be right, I downloaded a different version of the same book and it is highlighted correctly. Also I tried some journal papers with reference links (which means they're more likely legitimate PDFs) and highlighting is also correct there. – Yan King Yin Apr 25 '19 at 19:33
  • 1
    The bug can nevertheless still be reproduced. I also observe this problem on perhaps one out of ten pdf files I try to highlight. E.g. in the document you can download publicly from [here](https://www.cairn-int.info/load_pdf.php?ID_ARTICLE=E_AMX_051_0059) – IndexOutOfBoundsException Jun 01 '19 at 13:00

1 Answers1

3

According to the following bug report, the problem is related to how Poppler handles cropboxes. They say it is fixed in Poppler 0.86.0 onwards.

However, if you are still facing this problem (as it was my case) you can modify the PDF so that it does not have cropboxes. I have been able to do this by calling pdfjam without any arguments:

pdfjam original_file.pdf -o fixed_file.pdf

I am sure there must be better ways to do it, but I have only found this.

I have tested this method with this pdf and it works.

hrgu
  • 51
  • 5
  • That also worked for me with another pdf file. However, I noticed all my previous highlights disappeared after `pdfjam` command. So it makes sense to use `pdfjam` before any annotation. – arash Aug 24 '21 at 16:03
  • Funnily, just one day after finding @hrgu 's answer, I realized `pdfjam` indeed isn't a complete solution. Things like [this](https://ibb.co/4mYvfDv) can easily happen. Note that the (wrongly) integrated highlighting of the column and the figure caption. Nevertheless, still an effective one for a lot of pdf layouts. – arash Aug 25 '21 at 17:05
  • Thanks, works for me too! – Yan King Yin Jul 06 '22 at 16:19