org-export-to-file

org-export-to-file is an autoloaded Lisp function in `ox.el'.

(org-export-to-file BACKEND FILE &optional ASYNC SUBTREEP VISIBLE-ONLY BODY-ONLY EXT-PLIST POST-PROCESS)

Call `org-export-as' with output to a specified file.

BACKEND is either an export back-end, as returned by, e.g.,
`org-export-create-backend', or a symbol referring to
a registered back-end. FILE is the name of the output file, as
a string.

A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting buffer will then be accessible
through the `org-export-stack' interface.

Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
EXT-PLIST are similar to those used in `org-export-as', which
see.

Optional argument POST-PROCESS is called with FILE as its
argument and happens asynchronously when ASYNC is non-nil. It
has to return a file name, or nil. Export back-ends can use this
to send the output file through additional processing, e.g,

(defun org-latex-export-to-latex
(&optional async subtreep visible-only body-only ext-plist)
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file 'latex outfile
async subtreep visible-only body-only ext-plist
(lambda (file) (org-latex-compile file)))

The function returns either a file name returned by POST-PROCESS,
or FILE.