diff options
| author | Lars Ingebrigtsen | 2019-09-29 14:26:26 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-09-29 14:26:26 +0200 |
| commit | c9af343448e890a80093db03dd9a70f55c0cbde3 (patch) | |
| tree | 9335f94f6ebbe34bcc461bc403bed006040c311b | |
| parent | 58847eaf0d66ec4747ca56974327ccff2ba6c264 (diff) | |
| download | emacs-c9af343448e890a80093db03dd9a70f55c0cbde3.tar.gz emacs-c9af343448e890a80093db03dd9a70f55c0cbde3.zip | |
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.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/doc-view.el | 8 |
2 files changed, 10 insertions, 1 deletions
| @@ -607,6 +607,9 @@ its functions. | |||
| 607 | *** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'. | 607 | *** New commands 'doc-view-presentation' and 'doc-view-fit-window-to-page'. |
| 608 | *** Added support for password-protected PDF files | 608 | *** Added support for password-protected PDF files |
| 609 | 609 | ||
| 610 | *** A new variable 'doc-view-pdftotext-program-args' has been added to | ||
| 611 | allow controlling how the conversion to text is done. | ||
| 612 | |||
| 610 | ** Ido | 613 | ** Ido |
| 611 | *** New user option 'ido-big-directories' to mark directories whose | 614 | *** New user option 'ido-big-directories' to mark directories whose |
| 612 | names match certain regular expressions as big. Ido won't attempt to | 615 | 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 49d2b56b7d6..9d10d036285 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -172,6 +172,11 @@ | |||
| 172 | :type 'file | 172 | :type 'file |
| 173 | :version "24.4") | 173 | :version "24.4") |
| 174 | 174 | ||
| 175 | (defcustom doc-view-pdftotext-program-args '("-raw") | ||
| 176 | "Parameters to give to the pdftotext command." | ||
| 177 | :version "27.1" | ||
| 178 | :type '(repeat string)) | ||
| 179 | |||
| 175 | (defcustom doc-view-pdf->png-converter-function | 180 | (defcustom doc-view-pdf->png-converter-function |
| 176 | (if (executable-find doc-view-pdfdraw-program) | 181 | (if (executable-find doc-view-pdfdraw-program) |
| 177 | #'doc-view-pdf->png-converter-mupdf | 182 | #'doc-view-pdf->png-converter-mupdf |
| @@ -1132,7 +1137,8 @@ Start by converting PAGES, and then the rest." | |||
| 1132 | (or (executable-find doc-view-pdftotext-program) | 1137 | (or (executable-find doc-view-pdftotext-program) |
| 1133 | (error "You need the `pdftotext' program to convert a PDF to text")) | 1138 | (error "You need the `pdftotext' program to convert a PDF to text")) |
| 1134 | (doc-view-start-process "pdf->txt" doc-view-pdftotext-program | 1139 | (doc-view-start-process "pdf->txt" doc-view-pdftotext-program |
| 1135 | (list "-raw" pdf txt) | 1140 | (append doc-view-pdftotext-program-args |
| 1141 | (list pdf txt)) | ||
| 1136 | callback)) | 1142 | callback)) |
| 1137 | 1143 | ||
| 1138 | (defun doc-view-current-cache-doc-pdf () | 1144 | (defun doc-view-current-cache-doc-pdf () |