Navigation

Operators and Keywords

Function List:

C++ API

print.m File Reference


Functions

function print (varargin) persistent warn_on_inconsistent_orientation
 if (isunix()) persistent ghostscript_binary
 elseif (ispc()) if(~isempty(getenv("GSC"))) persistent ghostscript_binary
unwind_protect drawnow ()
 if (ischar(arg)) if(strcmp(arg
id use_color ()
 elseif (strcmp(arg,"-mono")) use_color
 elseif (strcmp(arg,"-solid")) force_solid
 elseif (strcmp(arg,"-dashed")) force_solid
 elseif (strcmp(arg,"-portrait")) orientation
 elseif (strcmp(arg,"-landscape")) orientation
 elseif (strcmp(arg,"-tight")) tight_flag
 elseif (strcmp(arg,"-textspecial")) special_flag
 elseif (strncmp(arg,"-debug", 6)) debug
 if (length(arg) > 7) debug_file
endif elseif (length(arg) > 2 &&arg(1:2)=="-d") devopt = arg
 elseif ((length(arg) > 2)&&arg(1:2)=="-G") ghostscript_binary
 if (idx) font
 if (doprint) if(isempty(devopt)) if(use_color< 0) devopt
endif if (isempty(devopt)) dot
if(dot==0) error("print endif if (!isempty(fontsize)) options
endif elseif (strcmp(dev,"tikz")) if(!isempty(font)&&!isempty(fontsize)) options
 elseif (!isempty(font)) options
endif elseif (strcmp(dev,"aifm")||strcmp(dev,"corel")) if(use_color >=0) options
endif if (!isempty(font)) options
endif elseif (strcmp(dev,"fig")) options
 if (use_color >=0) options
endif elseif (strcmp(dev,"emf")) options
endif if (force_solid >=0) options
endif elseif (any(strcmp(dev, bitmap_devices))) if(isempty(canvas_size)&&isempty(resolution)&&any(strcmp(dev
 elseif (strcmp(dev,"svg")) options
end if (!isempty(canvas_size)) options
endif elseif (any(strcmp(dev,{"dxf","mf","hpgl"}))) options
 elseif (strcmp(dev,"pdf")) options
 elseif (force_solid< 0) options
endif endif if (__gnuplot_has_feature__("variable_GPVAL_TERMINALS")) available_terminals
 if (strcmp(termn,"pdf")&&any(strcmp(available_terminals,"pdfcairo"))) termn
 elseif (strcmp(termn,"png")&&any(strcmp(available_terminals,"pngcairo"))) termn
endif elseif (strcmp(termn,"pdf")) if(have_ghostscript) gnuplot_supports_term
endif if (!gnuplot_supports_term) if(strcmp(termn
 if (strfind(name,".pdf")==numel(name)-3) ghostscript_output
else error ("print: the device, \"%s\", is not available.", dev) endif endif is_eps_file
 if (p.papersize(1) > p.papersize(2)) paperorientation
endif if (!strcmp(paperorientation, get(gcf,"paperorientation"))&&warn_on_inconsistent_orientation) msg
 warning ("%s", msg{:}) warn_on_inconsistent_orientation
endif if (strcmp(termn,"postscript")&&!strncmp(dev,"eps", 3)) if(isempty(orientation)) orientation
 if (isempty(resolution)) if(any(strcmp(dev
 if (resolution==0) resolution
 if (!isfield(figure_properties,"__pixels_per_inch__")) addproperty("__pixels_per_inch__"
endif set (gcf,"__pixels_per_inch__", resolution) unwind_protect set(gcf
 set (gcf,"units","pixels")
 if ((!output_for_printer||is_eps_file)&&!doprint) if(!isempty(canvas_size)) size_in_pixels
 paperposition_in_inches (1:2)=0
endif set (gcf,"papersize", papersize_in_inches)
 set (gcf,"paperposition", paperposition_in_inches)
 set (gcf,"paperpositionmode","manual")
else if (strcmp(p.paperpositionmode,"auto")) size_in_pixels
 paperposition_in_inches (3:4)
endif if (!isempty(orientation)&&!strcmp(orientation, paperorientation)) restore_properties
 set (gcf,"papersize", p.papersize([2, 1]))
 set (gcf,"paperposition", paperposition_in_inches([2, 1, 4, 3]))
endif endif if (use_color< 0)[objs_with_color
endif if (debug) drawnow(new_terminal
else drawnow (new_terminal, name, mono)
endif unwind_protect_cleanup if (restore_properties) props
endif end_unwind_protect if (!isempty(ghostscript_output)) if(is_eps_file &&tight_flag) fix_eps_bbox(name
 if (is_eps_file) ghostscript_options
endif if (isempty(strfind(lower(ghostscript_device),"write"))) ghostscript_options
 unlink (name)
 if (status==0) pattern
 if (iscell(bbox_line)) bbox_line
endif bbox_line (double(bbox_line)< 32)
 while (!bbox_replaced) current_line
 if (strncmpi(current_line, box_string, numel(box_string))) line_length
 new_line (end+1:numel(current_line))
endif if (ispc()) fseek(fid
id cof ()
else fseek (fid,-line_length-1,"cof")
 elseif (!ischar(current_line)) bbox_replaced
 warning ("print.m: no bounding box found in '%s'.", eps_file_name) endif endwhile unwind_protect_cleanup fclose(fid)
end_unwind_protect elseif (warn_on_no_ghostscript) warn_on_no_ghostscript
 warning ("print.m: Ghostscript failed to determine the bounding box.\nError was:\n%s\n", output) endif endfunction function[h
 set (0,"showhiddenhandles","on")
unwind_protect_cleanup set (0,"showhiddenhandles", showhiddenhandles)
 if (!iscell(v)) v
endif c (f{nf})
endif endfor convert_mono_to_or_from_color (h, c, true) endfunction function convert_mono_to_or_from_color(h
 if (isfloat(color)) if(mono) color
endif set (h.(f{nf})(nh), f{nf}, color)

Variables

 use_color = 0
 force_solid = 0
 fontsize = ""
 font = ""
 canvas_size = ""
 name = ""
 devopt = ""
 printer = ""
 debug = false
 debug_file = "octave-print-commands.log"
 special_flag = "textnormal"
 tight_flag = false
 resolution = ""
else persistent ghostscript_binary = "gswin32c"
endif endif old_fig = get (0, "currentfigure")
for i
elseif(length(arg) >=1 &&arg(1)=="-")
error("print 
have_ghostscript = (status ~= 0)
endif doprint = isempty (name)
 printname = cstrcat (tmpnam, ".ps")
else options = ""
 available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match")
 gnuplot_supports_term = true
 ghostscript_device = "pdfwrite"
else ghostscript_output = strcat (name, ".pdf")
 termn = "postscript"
units = get (gcf, "units")
paperunits = get (gcf, "paperunits")
papersize = get (gcf, "papersize")
paperposition = get (gcf, "paperposition")
paperpositionmode = get (gcf, "paperpositionmode")
paperorientation = get (gcf, "paperorientation")
end new_terminal = cstrcat (termn, " ", options)
 mono = (use_color < 0)
 terminals_for_prn = {"postscript", "pdf", "pdfcairo"}
 output_for_printer = any (strncmp (termn, terminals_for_prn, numel(termn)))
endif endif figure_properties = get (gcf)
 gcf
 double
endif inches
 restore_properties = true
 size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)])
 papersize_in_inches = size_in_pixels ./ resolution
 paperposition_in_inches = [0, 0, papersize_in_inches]
endif endif color_of_objs = convert_color2mono (gcf)
for n
endif ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4"
 command
 if (errcode) error("print[status, output] = system (cmd)
 pattern = pattern(1:find(double(pattern)>32, 1, "last"))
 bbox_line = regexp (output, pattern, "match")
 fid = fopen (eps_file_name, "r+")
unwind_protect bbox_replaced = false
 num_spaces = line_length - numel (bbox_line)
else new_line = bbox_line
endif count = fprintf (fid, "%s", new_line)
 c
color = findobj (hfig, "-property", "color")
facecolor = findobj (hfig, "-property", "facecolor")
edgecolor = findobj (hfig, "-property", "edgecolor")
backgroundcolor = findobj (hfig, "-property", "backgroundcolor")
colormap = findobj (hfig, "-property", "colormap")
end_unwind_protect f = fieldnames (h)
for nf

Function Documentation

endif bbox_line (  ) 

endif c (  ) 

id cof (  )  [virtual]

endif endfor convert_mono_to_or_from_color ( ,
,
true   
)

else drawnow ( new_terminal  ,
name  ,
mono   
)

unwind_protect drawnow (  ) 

end_unwind_protect elseif ( warn_on_no_ghostscript   ) 

elseif ( ischarcurrent_line  ) 

endif elseif ( strcmp(termn,"pdf")   ) 

elseif ( strcmp(termn,"png")&&any(strcmp(available_terminals,"pngcairo"))   ) 

elseif (  ) 

elseif ( strcmp(dev,"pdf")   ) 

endif elseif ( any(strcmp(dev,{"dxf","mf","hpgl"}))   ) 

elseif ( strcmp(dev,"svg")   ) 

endif elseif ( any(strcmp(dev, bitmap_devices))   ) 

endif elseif ( strcmp(dev,"emf")   ) 

endif elseif ( strcmp(dev,"fig")   ) 

endif elseif ( strcmp(dev,"aifm")||strcmp(dev,"corel")   )  [pure virtual]

elseif ( isemptyfont  ) 

endif elseif ( strcmp(dev,"tikz")   ) 

elseif ( (length(arg) > 2)&&arg(1:2)  = ="-G"  ) 

elseif ( length(arg)  ,
2 &&  arg1:2 = ="-d" 
) = arg

elseif ( strncmp(arg,"-debug", 6)   ) 

elseif ( strcmp(arg,"-textspecial")   ) 

elseif ( strcmp(arg,"-tight")   ) 

elseif ( strcmp(arg,"-landscape")   ) 

elseif ( strcmp(arg,"-portrait")   ) 

elseif ( strcmp(arg,"-dashed")   ) 

elseif ( strcmp(arg,"-solid")   ) 

elseif ( strcmp(arg,"-mono")   ) 

elseif ( ispc()   ) 

else error ( "print: the   device,
\"%s\"  ,
is not available."  ,
dev   
)

else fseek ( fid  ,
-line_length-  1,
"cof"   
)

if ( isfloat(color  ) 

if ( iscellv  ) 

endif if ( ispc()   ) 

if ( strncmpi(current_line, box_string, numel(box_string))   ) 

if ( iscell(bbox_line)   ) 

if ( status  = =0  ) 

endif if ( isempty(strfind(lower(ghostscript_device),"write"))   ) 

if ( is_eps_file   ) 

endif end_unwind_protect if ( isemptyghostscript_output  ) 

endif unwind_protect_cleanup if ( restore_properties   ) 

endif if ( debug   ) 

endif endif if (  ) 

endif if ( isemptyorientation)&&!strcmp(orientation, paperorientation  ) 

else if ( strcmp(p.paperpositionmode,"auto")   ) 

if ( (!output_for_printer||is_eps_file)&&!  doprint  ) 

if ( isfieldfigure_properties,"__pixels_per_inch__"  ) 

if ( resolution  = =0  ) 

if ( isempty(resolution  ) 

endif if ( strcmp(termn,"postscript")&&!strncmp(dev,"eps", 3)   ) 

endif if ( !strcmp(paperorientation, get(gcf,"paperorientation"))&&  warn_on_inconsistent_orientation  ) 

if ( p.  papersize1,
p.  papersize2 
)

if ( strfind(name,".pdf")  = =numel(name)-3  ) 

endif if ( gnuplot_supports_term  ) 

if ( strcmp(termn,"pdf")&&any(strcmp(available_terminals,"pdfcairo"))   ) 

endif endif if ( __gnuplot_has_feature__("variable_GPVAL_TERMINALS")   ) 

end if ( isemptycanvas_size  ) 

endif if ( force_solid >=  0  ) 

if ( use_color >=  0  ) 

endif if ( isemptyfont  ) 

if (dot == 0) error ("print endif if ( isemptyfontsize  ) 

endif if ( isempty(devopt  ) 

if ( doprint   ) 

if ( idx   ) 

if ( length(arg)  ,
 
)

if ( ischar(arg)   ) 

if ( isunix()   ) 

new_line ( end+1:  numelcurrent_line  ) 

paperposition_in_inches ( 3:4   ) 

paperposition_in_inches ( 1:2   )  [pure virtual]

function print ( varargin   ) 

endif set ( h.  f{nf})(nh  ) 

unwind_protect_cleanup set ( ,
"showhiddenhandles"  ,
showhiddenhandles   
)

set ( ,
"showhiddenhandles"  ,
"on"   
)

set ( gcf  ,
"paperposition"  ,
paperposition_in_inches([2, 1, 4, 3])   
)

set ( gcf  ,
"papersize"  ,
p.  papersize[2, 1] 
)

set ( gcf  ,
"paperpositionmode"  ,
"manual"   
)

set ( gcf  ,
"paperposition"  ,
paperposition_in_inches   
)

endif set ( gcf  ,
"papersize"  ,
papersize_in_inches   
)

set ( gcf  ,
"units"  ,
"pixels"   
)

endif set ( gcf  ,
"__pixels_per_inch__"  ,
resolution   
)

unlink ( name   ) 

id use_color (  )  [virtual]

warning ( "print.m: Ghostscript failed to determine the bounding box.\nError was:\n%s\n"   ,
output   
)

warning ( "print.m: no bounding box found in '%s'."  ,
eps_file_name   
)

warning ( "%s"   ) 

while ( bbox_replaced  ) 


Variable Documentation

available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match")

h backgroundcolor = findobj (hfig, "-property", "backgroundcolor")

bbox_line = regexp (output, pattern, "match")

bbox_replaced = false

Initial value:

h color = findobj (hfig, "-property", "color")

endif endif color_of_objs = convert_color2mono (gcf)

h colormap = findobj (hfig, "-property", "colormap")

Initial value:

 sprintf ("\"%s\" %s -sOutputFile=\"%s\" \"%s\" 2>&1", ghostscript_binary,
                          ghostscript_options, ghostscript_output, name)

endif count = fprintf (fid, "%s", new_line)

debug = false

endif debug_file = "octave-print-commands.log"

else devopt = ""

endif doprint = isempty (name)

h edgecolor = findobj (hfig, "-property", "edgecolor")

endif endfor mono f = fieldnames (h)

h facecolor = findobj (hfig, "-property", "facecolor")

fid = fopen (eps_file_name, "r+")

else font = ""

fontsize = ""

gcf

endif ghostscript_options = "-q -dBATCH -dSAFER -dNOPAUSE -dTextAlphaBits=4"

else ghostscript_output = strcat (name, ".pdf")

elseif (length (arg) >= 1 && arg(1) == "-") error ("print have_ghostscript = (status ~= 0)

for i

Initial value:

if(errcode) error("print[status, output] = system (cmd)

endif mono = (use_color < 0)

for n

Initial value:

endif name = ""

else new_line = bbox_line

end new_terminal = cstrcat (termn, " ", options)

Initial value:

 1:numel(f)
    if (! isempty (h.(f{nf})))
      v = get (h.(f{nf}), f{nf})

num_spaces = line_length - numel (bbox_line)

endif endif old_fig = get (0, "currentfigure")

endif options = ""

output_for_printer = any (strncmp (termn, terminals_for_prn, numel(termn)))

else paperorientation = get (gcf, "paperorientation")

p paperposition = get (gcf, "paperposition")

else paperposition_in_inches = [0, 0, papersize_in_inches]

p paperpositionmode = get (gcf, "paperpositionmode")

p papersize = get (gcf, "papersize")

endif paperunits = get (gcf, "paperunits")

pattern = pattern(1:find(double(pattern)>32, 1, "last"))

printer = ""

endif else printname = cstrcat (tmpnam, ".ps")

size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)])

special_flag = "textnormal"

terminals_for_prn = {"postscript", "pdf", "pdfcairo"}

termn = "postscript"

tight_flag = false

p units = get (gcf, "units")

use_color = 0