Subject: bug#60308: 30.0.50; Can't read some PDF files any more

From: Manuel Giraud <[email-masked]>
Date: Sat, 07 Jan 2023 16:48:22 +0100

Stephen Berman <[email-masked]> writes:

[...]

> FTR, I just updated my mupdf to 1.21.1 and unfortunately the problem
> remains as before.  I'll try to file a bug report with mupdf.

Hi,

Here a first patch that prevent producing SVG when mutool has a
version > 1.20.  Feel free to comment and fix.

Best regards,
>From 21c0e276189438ef04500697ef22ce663f650b3b Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Sat, 7 Jan 2023 16:40:58 +0100
Subject: [PATCH] Prevent DocView to produce SVG with mutool for version > 1.20
 (bug#60308)

* lisp/doc-view.el (doc-view-mutool-version): New variable
containing the mutool version string.
(doc-view-mupdf-use-svg): If the mutool version is higher than
1.20 do not use SVG output.
---
 lisp/doc-view.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 7c272f52fb3..3253387e01e 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -209,7 +209,19 @@ doc-view-pdf->png-converter-function
           function)
   :version "24.4")
 
-(defcustom doc-view-mupdf-use-svg (image-type-available-p 'svg)
+(defvar doc-view-mutool-version
+  (let ((mutool (executable-find "mutool")))
+    (if mutool
+        (with-temp-buffer
+          (call-process mutool nil t nil "-v")
+          (goto-char (point-min))
+          (re-search-forward "^mutool version \\([^ ]+\\)\n")
+          (match-string 1))
+      "")))
+
+(defcustom doc-view-mupdf-use-svg (and (image-type-available-p 'svg)
+                                       (string-version-lessp doc-view-mutool-version
+                                                             "1.20"))
   "Whether to use svg images for PDF files."
   :type 'boolean
   :version "29.1")
-- 
2.39.0

-- 
Manuel Giraud