help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Printing from WindowXP version of emacs


From: BRUCE INGALLS
Subject: Re: Printing from WindowXP version of emacs
Date: Tue, 3 Jan 2006 19:34:04 -0500

From: Peter Dyballa
Date: Tue, 3 Jan 2006 10:44:15 +0100
Subject: Re: Printing from WindowXP version of emacs

> That said, yet another hack is available: there already is code to
> export emacs buffers to PDF.

Could you drop some names, please?

Feel free to browse http://EMacro.sf.net/ for more of this stuff.
I expect to make a new release, this month.
Here is the relevant code, from e-common.el:

;;Note that ps2pdf might not be installed
(defun save-current-buffer-as-pdf ()
  "Export pretty-printed file to PDF format."
  (interactive)
  (ps-print-buffer-with-faces (concat (buffer-file-name) ".ps"))
  (shell-command (concat "ps2pdf " (buffer-file-name) ".ps"))
  (delete-file (concat (buffer-file-name) ".ps"))
  (message "Done"))

(defvar cache-htmlize)            ;shut up compiler
(cache-locate-library
 use-cache 'cache-htmlize "htmlize"
 "To export as HTML, get htmlize.el from <url:http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el>")

(when cache-htmlize (require 'htmlize))

(when (or cache-htmlize (which "ps2pdf"))
  (easy-menu-change file-menu "Export As"
            (list
             ["PDF" save-current-buffer-as-pdf
              (if (which "ps2pdf") t nil)] ;enable only if in PATH
             ["HTML" htmlize-buffer
              (if cache-htmlize t nil)])))

;;note that cache-htmlize can be replaced by a slower call to locate-library()


reply via email to

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