2

Since I feel that ghostscript is buggy on my surface laptop (at least its not working properly for doc-view in emacs with the pdf-Documents I want view; its beamer.pdf created with org-mode-beamer with complex huge pictures integrated; doc-view works but every time I want to view a slide with a complex picture, this nasty gsview64c.exe repeatedly hangs up) I would like to change to mupdf. Unfortunatly I cannot figure out how to do this.

I couldnt find any useful resources online explaining how to use mutool for pdf-rendering / pdf->png conversion.

I guess that I have to adapt doc-view.el!? The variable doc-view-pdfdraw-program contains the String "mudraw", which definitely is not the correct name in a Windows system. This variable is defined in doc-view.el as follows:

(defcustom doc-view-pdfdraw-program
  (cond
   ((executable-find "pdfdraw") "pdfdraw")
   (t "mudraw"))
  "Name of MuPDF's program to convert PDF files to PNG."
  :type 'file
  :version "24.4")

SO (executable-find "pdfdraw") evaluates to false on my system an "mudraw" is chosen as return vaulue, which doesnt work either on the windows platform (Win 10).

After installing mupdf on Windows the command name is definitely not mudraw but it's mutool draw. I tried to replace (t "mudraw") by (t "mutool draw) but it still doesnt work for the pdf-Files I have.

Is there anybody out there who already integrated Windows' mutool draw as a png rederer?

1

It should just work as long as doc-view-pdfdraw-program either contains the absolute file name of the mudraw executable, or the executable can be found in exec-path.

If that is the case, then doc-view-pdf->png-converter-function should automatically default to the proper function, i.e. doc-view-pdf->png-converter-mupdf.

  • Thanks for your answer! Since I work with Windows 10 with an Ubuntu-Subsystem integrated, I guess that there are 3 Options: 1. Install mupdf-tools via sudo apt install mupdf-tools in the Windows bash; 2. install mudf-tools via cygwin (maybe not advisable, since my emacs bases on mingw32) 3. Use mupdf for WIndows / mutool.. Does anyone have the experience whats best? – phynfo Aug 6 '17 at 17:49
1

This does not directly answer your question, but pdf-tools now works on windows without problems. It works very well with interleave-mode.

I followed the compilation instructions under https://github.com/politza/pdf-tools using msys2 (no cygwin needed).

I had some problems getting pdf-tools to find epdfinfo.exe (the file created by the compilation step above), in the end, I manually copied epdfinfo.exe into the pdf-tools folder. Also you need to make sure that all the dlls are in the path, e.g. libcairo, libpng, zlib, imagemagick, libpoppler etc.

1

mutool.exe is enough to view PDF in Emacs,

  1. put mutool.exe in .exec-path.
  2. doc-view-mode-p function always return nil for 'pdf TYPE. you need to let doc-view-mode-p return t for 'pdf.

    
    (defadvice doc-view-mode-p (after doc-view-mode-p-after compile)
      "fix: the builtin `doc-view-mode-p' does not support mupdf."
      (when (eq 'pdf (ad-get-arg 0))
        (setq ad-return-value t)))
    

  3. make mudraw.bat and pdfinfo.bat in your .exec-path

    mudraw.bat

    
    @echo on
    mutool draw %*
    

    pdfinfo.bat

    
    @echo on
    mutool info %*
    
  4. see on-docview-autoload.el for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.