Function: doc-view-odf->pdf-converter-soffice
doc-view-odf->pdf-converter-soffice is a byte-compiled function
defined in doc-view.el.gz.
Signature
(doc-view-odf->pdf-converter-soffice ODF CALLBACK)
Documentation
Convert ODF to PDF asynchronously and call CALLBACK when finished.
The converted PDF is put into the current cache directory, and it is named like ODF with the extension turned to pdf.
Source Code
;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-odf->pdf-converter-soffice (odf callback)
"Convert ODF to PDF asynchronously and call CALLBACK when finished.
The converted PDF is put into the current cache directory, and it
is named like ODF with the extension turned to pdf."
;; FIXME: soffice doesn't work when there's another running
;; LibreOffice instance, in which case it returns success without
;; actually doing anything. See LibreOffice bug
;; https://bugs.freedesktop.org/show_bug.cgi?id=37531. A workaround
;; is to start soffice with a separate UserInstallation directory.
(let ((tmp-user-install-dir (make-temp-file "libreoffice-docview" t)))
(doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
(list
(concat "-env:UserInstallation=file://"
;; The URL must be
;; file:///C:/tmp/dir on Windows.
;; https://wiki.documentfoundation.org/UserProfile.
(when (eq system-type 'windows-nt)
"/")
tmp-user-install-dir)
"--headless" "--convert-to" "pdf"
"--outdir" (doc-view--current-cache-dir) odf)
(lambda ()
(delete-directory tmp-user-install-dir t)
(funcall callback)))))