7

Of course I already know about https://github.com/politza/pdf-tools.


I am on Emacs 24.5.1.

I am not convinced that doc-view is using mudraw/mupdf for pdf files.

(require 'doc-view)
(print doc-view-pdfdraw-program)

outputs

"mudraw"
"mudraw"

However, the following screenshot says otherwise:

emacs doc-view vs zathura with mupdf

Emacs using doc-view on the left, zathura with mupdf backend on the right. Same pdf file, zoomed by hand to approximately the same level. The pdf is here.

As you can see, in the sentence starting with "For instance" for example, the superscript p, and the subscript n are much clearer in zathura. In doc-view, the n in particular is barely readable, if at all, even at this level of zoom.


I am obviously missing something, but not sure what.

(setq doc-view-pdf->png-converter-invocation
      'doc-view-pdf->png-converter-invocation-mupdf)

from http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13164 does not seem to work.

The official documentation does not say much. Searching for answers comes up with that mupdf should be automatically used if it exists. I am on archlinux and have the official ghostscript and mupdf packages installed. The strange thing is (print doc-view-pdfdraw-program) still outputs "mudraw" even after I uninstall the official mupdf package (and after restarting emacs), although this is likely irrelevant.


If you the reader is successfully using mudraw/mupdf with doc-view, then perhaps you might want to download that pdf (and install zathura temporarily) and test out the quality you see in each program. If you see the same or similar thing as my screenshot, perhaps there is no problem here.

Perhaps the mupdf being used by zathura is actually different than the original one/the one doc-view uses. If I recall correctly, zathura uses its own slightly patched version of mupdf. However, my understanding was that zathura slightly patches it so that it works better with zathura itself, not necessarily patching the rendering parts themselves. This comment also seems to suggest that there should be very little, if any, differences between the rendering qualities (and speeds) between doc-view using mudraw/mupdf and zathura with mupdf backend.

vyp
  • 243
  • 2
  • 10
  • 1
    Try to run `mudraw` with the same arguments as docview does, and compare the quality of the resulting image. –  Jul 05 '15 at 12:31
  • How do I use `mudraw`? For example I used `mudraw -o euclid.png euclid.pjm.1102986512.pdf` but the `euclid.png` file is just a blank (white) page. – vyp Jul 05 '15 at 12:34
  • Nevermind, I did it by specifying the page number `1` at the end of that command. However, the [image](http://i.imgur.com/OW2iFBV.png) quality is worse than even the doc-view one. – vyp Jul 05 '15 at 12:38
  • 2
    Okay I set the resolution better, to `300` using the `-r` option. http://i.imgur.com/P9kK9Sj.png. So `(setq doc-view-resolution 300)` is the solution. (After `(doc-view-clear-cache)`.) – vyp Jul 05 '15 at 12:46
  • 1
    Please turn your last comment into an answer and accept it, to help other users which have the same problem. –  Jul 05 '15 at 12:47
  • 1
    For the record I've settled on a dpi of `144` because it seems to be a tradeoff between speed and quality. – vyp Jul 05 '15 at 12:56
  • To be fair, I would have never have figured out it was just the resolution setting if you hadn't suggested using `mudraw` directly to test. I was looking for solutions for some time before asking here. -_- – vyp Jul 05 '15 at 13:09

1 Answers1

10

The default resolution is probably around 90 dpi.

(require 'doc-view)
(setq doc-view-resolution 144)

(Or set higher as you need.)

You may need to run doc-view-clear-cache first for the change to be respected.

vyp
  • 243
  • 2
  • 10