Initial Commit
[packages] / xemacs-packages / w3 / lisp / w3-print.el
1 ;;; w3-print.el --- Printing support for emacs-w3
2 ;; Author: $Author: fx $
3 ;; Created: $Date: 2001/06/07 17:16:57 $
4 ;; Version: $Revision: 1.3 $
5 ;; Keywords: faces, help, printing, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu>
9 ;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
10 ;;;
11 ;;; This file is part of GNU Emacs.
12 ;;;
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;;; it under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 2, or (at your option)
16 ;;; any later version.
17 ;;;
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Emacs; see the file COPYING.  If not, write to the
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;;; Boston, MA 02111-1307, USA.
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 (defvar w3-postscript-print-function 'ps-print-buffer-with-faces
29   "*Name of the function to use to print a buffer as PostScript.
30 This should take no arguments, and act on the current buffer.
31 Possible values include:
32 ps-print-buffer-with-faces   - print immediately
33 ps-spool-buffer-with-faces   - spool for later")
34
35 ;;;###autoload
36 (defun w3-print-this-url (&optional url format)
37   "Print out the current document"
38   (interactive)
39   (if (not url) (setq url (url-view-url t)))
40   (let* ((completion-ignore-case t)
41          (format (or format
42                      (completing-read
43                       "Format: "
44                       '(("HTML Source")         ; The raw HTML code
45                         ("Formatted Text")      ; Plain ASCII rendition
46                         ("PostScript")          ; Pretty PostScript
47                         )
48                       nil t))))
49       (cond
50        ((equal "HTML Source" format)
51       (save-excursion
52         (set-buffer (generate-new-buffer " *w3-print*"))
53         (insert w3-current-source)
54         (lpr-buffer)))
55        ((or (equal "Formatted Text" format)
56             (equal "" format))
57         (lpr-buffer))
58        ((equal "PostScript" format)
59       (funcall w3-postscript-print-function)))))
60
61 (provide 'w3-print)