Mercurial > octave-nkf
comparison scripts/plot/private/__ghostscript__.m @ 10834:05ba991794d4
Improvements for fltk printing.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 29 Jul 2010 19:44:07 -0400 |
parents | |
children | d5a7db05d591 |
comparison
equal
deleted
inserted
replaced
10833:e5c752231985 | 10834:05ba991794d4 |
---|---|
1 ## Copyright (C) 2010 Ben Abbott | |
2 ## | |
3 ## This program is free software; you can redistribute it and/or modify | |
4 ## it under the terms of the GNU General Public License as published by | |
5 ## the Free Software Foundation; either version 2 of the License, or | |
6 ## (at your option) any later version. | |
7 ## | |
8 ## This program is distributed in the hope that it will be useful, | |
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 ## GNU General Public License for more details. | |
12 ## | |
13 ## You should have received a copy of the GNU General Public License | |
14 ## along with Octave; see the file COPYING. If not, see | |
15 ## <http://www.gnu.org/licenses/>. | |
16 | |
17 ## -*- texinfo -*- | |
18 ## @deftypefn {Function File} {} __ghostscript__ (@var{@dots{}}) | |
19 ## Undocumented internal function. | |
20 ## @end deftypefn | |
21 | |
22 ## Author: Ben Abbott <bpabbott@mac.com> | |
23 ## Created: 2010-07-26 | |
24 | |
25 function status = __ghostscript__ (opts, varargin); | |
26 | |
27 if (nargin > 1) | |
28 opts.name = varargin{1}; | |
29 endif | |
30 if (nargin > 2) | |
31 opts.ghostscript_device = varargin{2}; | |
32 endif | |
33 if (nargin > 3) | |
34 opts.ghostscript_output = varargin{3}; | |
35 endif | |
36 | |
37 if (strncmp (opts.devopt, "eps", 3)) | |
38 ## "eps" files | |
39 gs_opts = "-q -dNOPAUSE -dBATCH -dSAFER -dEPSCrop"; | |
40 else | |
41 ## "ps" or "pdf" files | |
42 gs_opts = "-q -dNOPAUSE -dBATCH -dSAFER"; | |
43 endif | |
44 | |
45 cmd = sprintf ("%s %s -sDEVICE=%s -r%d -sOutputFile=%s %s", | |
46 opts.ghostscript_binary, gs_opts, opts.ghostscript_device, | |
47 opts.resolution, opts.ghostscript_output, opts.name); | |
48 | |
49 if (opts.debug) | |
50 fprintf ("Ghostscript command: %s\n", cmd); | |
51 endif | |
52 | |
53 [status, output] = system (cmd); | |
54 | |
55 if (status != 0) | |
56 warning ("print:ghostscripterror", | |
57 "print.m: gs failed to convert output to file '%s'.", opts.ghostscript_output) | |
58 endif | |
59 | |
60 endfunction |