0

Currently, when I use Okular, I can either be in highlight mode or text selection mode, but not both at the same time, which is very annoying because, while reading, I often copy excerpts of the text into a note somewhere, so I can have a compact compendium of highlights mixed with my own notes.

Is it possible to hack something inside okularrc to make all this possible?

This is the type of thing that's seems intuitive enough for it to be inside the settings menu, but I haven't found it yet. Is it there?

I wish this type of behavior — as well as highlighting — were featured in Zathura, but apparently there are no such features there yet. Does anyone know of a Zathura stable fork or similar software that does feature all this? Of course, this isn't really a mandatory part of an answer, just something that I find might be useful to other users also.

There's a similar question to this problem here, where somebody found a solution to it through forking and modifying Okular. But I'm afraid I don't have the know-how nor enough interest to go that far.

1
  • Is there an Okular or Zathura fork somewhere with this functionality?
    – psygo
    Apr 8, 2021 at 19:04

1 Answer 1

1

I don't think this can be done in Okular (AFAIK, you can only select text while you're in Text Selection mode), but qpdfview allows you to hold down the shift key and right-click + drag to select an area on the page being viewed.

When you've finished selecting the area, it pops up a menu allowing you to "Copy text", "Select text", "Copy image", and "Save image to file".

"Select" copies the text into X's selection buffer (i.e. for middle-button paste), "Copy" copies it into the Clipboard.

The Copy & Select Text options are only available if there is actual text in the PDF (and not just an image of text).

Worth noting: qpdfview supports both Bookmarks and Annotations.

BTW, if your PDF does not have actual selectable text in it, but does have reasonably clean scanned images of text, you may be able to add a text layer with ocrmypdf. Note that a poor quality scan, or a scan with a "noisy" background will greatly affect the quality of the resulting text. Note that ocrmypdf has a lot of dependencies and requires python3, ghostscript, tesseract-ocr and more.

Finally, if your PDF does have a text layer (or you added one with ocrmypdf) you can extract all the text with pdftotext from poppler-utils. If you have $LESSOPEN configured to run lesspipe, you can even run less filename.pdf, and less will automatically run pdftotext to view the text in the .PDF file - copy-pasting text from less is easy and straight-forward.

All of the programs I mentioned should be available pre-packaged for your distro. They certainly are for debian, probably ubuntu too, and I'd be surprised if most of the others didn't have them too.

1
  • I don't think qpdf's behavior is really what I meant unfortunately. I'm not sure there is a "copy-while-highlighting" behavior there. And I apparently can't change the way it inverts colors — I typically use Darcula themed colors for reading, not the super high contrast inversion you typically get.
    – psygo
    Apr 4, 2021 at 20:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .