org-export-to-buffer

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

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

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

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.

BUFFER is the name of the output buffer. If it already exists,
it will be erased first, otherwise, it will be created.

A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting buffer should then be accessible
through the `org-export-stack' interface. When ASYNC is nil, the
buffer is displayed if `org-export-show-temporary-export-buffer'
is non-nil.

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 a function which should accept
no argument. It is always called within the current process,
from BUFFER, with point at its beginning. Export back-ends can
use it to set a major mode there, e.g,

(defun org-latex-export-as-latex
(&optional async subtreep visible-only body-only ext-plist)
(interactive)
(org-export-to-buffer 'latex "*Org LATEX Export*"
async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode))))

This function returns BUFFER.