emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c9af343: Allow customising pdf-to-text parameters


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master c9af343: Allow customising pdf-to-text parameters
Date: Sun, 29 Sep 2019 08:26:35 -0400 (EDT)

branch: master
commit c9af343448e890a80093db03dd9a70f55c0cbde3
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Allow customising pdf-to-text parameters
    
    * lisp/doc-view.el (doc-view-pdf->txt): Allow customising the
    parameters (bug#8519).
    (doc-view-pdftotext-program-args): New variable.
---
 etc/NEWS         | 3 +++
 lisp/doc-view.el | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index f858c95..cb8b6fc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -607,6 +607,9 @@ its functions.
 *** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'.
 *** Added support for password-protected PDF files
 
+*** A new variable 'doc-view-pdftotext-program-args' has been added to
+allow controlling how the conversion to text is done.
+
 ** Ido
 *** New user option 'ido-big-directories' to mark directories whose
 names match certain regular expressions as big.  Ido won't attempt to
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 49d2b56..9d10d03 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -172,6 +172,11 @@
   :type 'file
   :version "24.4")
 
+(defcustom doc-view-pdftotext-program-args '("-raw")
+  "Parameters to give to the pdftotext command."
+  :version "27.1"
+  :type '(repeat string))
+
 (defcustom doc-view-pdf->png-converter-function
   (if (executable-find doc-view-pdfdraw-program)
       #'doc-view-pdf->png-converter-mupdf
@@ -1132,7 +1137,8 @@ Start by converting PAGES, and then the rest."
   (or (executable-find doc-view-pdftotext-program)
       (error "You need the `pdftotext' program to convert a PDF to text"))
   (doc-view-start-process "pdf->txt" doc-view-pdftotext-program
-                          (list "-raw" pdf txt)
+                          (append doc-view-pdftotext-program-args
+                                  (list pdf txt))
                           callback))
 
 (defun doc-view-current-cache-doc-pdf ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]