changeset 17397:50794f5e2323

Set gs sOutputFile option to "-" when spooling to the system printer. * scripts/plot/private/__print_parse_opts__.m: When sending output to a printer set the output to "-" which is ghostscript syntax for piping.
author Ben Abbott <bpabbott@mac.com>
date Thu, 05 Sep 2013 19:46:47 -0400
parents b91f29f021a3
children 06b46e67f868
files scripts/plot/private/__print_parse_opts__.m
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/private/__print_parse_opts__.m
+++ b/scripts/plot/private/__print_parse_opts__.m
@@ -327,6 +327,22 @@
     arg_st.ghostscript.epscrop = ! arg_st.loose;
   endif
 
+  if (arg_st.send_to_printer)
+    if (isempty (arg_st.name))
+      ## Pipe the ghostscript output 
+      arg_st.name = "-";
+    else
+      error ("print: a file name may not specified when spooling to a printer")
+    endif
+    if (! any (strcmp (arg_st.devopt, gs_device_list))
+      || ! any (strcmp (arg_st.devopt, {"pswrite", "ps2write"})))
+      ## Only postscript and supported ghostscript devices
+      error ("print: invalid format for spooling to a printer")
+    endif
+  elseif (isempty (arg_st.name))
+    error ("print: an output file name must be specified")
+  endif
+
   if (isempty (arg_st.canvas_size))
     if (isfigure (arg_st.figure))
       [arg_st.ghostscript.papersize, paperposition] = ...