ps.end: Close PostScript or Acrobat Graphics Device opened by 'ps.do'...

View source: R/ps.goodies.R

ps.endR Documentation

Close PostScript or Acrobat Graphics Device opened by 'ps.do' / 'pdf.do'

Description

Closes the PostScript or PDF file (postscript,pdf), openend by a previous ps.do (or pdf.latex, or ...) call, using dev.off, and additionally opens a previewer for that file, unless the previewer is already up. This almost provides an ‘interactive’ device (like x11) for postscript or pdf.

Usage

ps.end(call.gv= NULL, command = getOption("eps_view"),
       debug = getOption("verbose"))
pdf.end(call.viewer= NULL, command = getOption("pdfviewer"),
       debug = getOption("verbose"))

Arguments

call.gv, call.viewer

logical, indicating if the postscript or acrobat reader (e.g., ghostview or acroread or the command given by command) should be called. By default, find out if the viewer is already runing on this file and only call it if needed.

command

character, giving a system command for PostScript previewing. By default, getOption("eps_view") is set to
gv -watch -geometry -0+0 -magstep -2 -media BBox -noantialias which assumes gv (aka ghostview) to be in your OS path.

debug

logical; if TRUE print information during execution.

Details

Depends on Unix tools, such as ps.

Author(s)

Martin Maechler

See Also

postscript, postscript pdf.do, ps.do, ...

Examples

if(interactive() 
  ) {
    myPS <- tempfile("ex", fileext = ".ps")
    ps.do(myPS)
    data(sunspots)
    plot(sunspots)
    ps.end()

    tempfile("ex-sun", fileext = ".pdf") -> myPDF
    pdf.latex(myPDF)
    plot(sunspots)
    pdf.end(call. = FALSE) # basically the same as dev.off()
  }
  ps.latex(tempfile("ex2", fileext = ".eps"))
  plot(sunspots)
  ps.end(call.gv = FALSE) # basically the same as dev.off()

sfsmisc documentation built on Sept. 11, 2024, 6:53 p.m.