Learn R Programming

latexpdf (version 0.1.8)

ghostconvert: Call Ghostscript.

Description

Call Ghostscript, converting by default from PDF to PNG.

Usage

ghostconvert(
  x,
  y = file.path(gdir, out),
  gdir = dirname(x),
  out = sub("\\.[^.]+$", paste0(if (multipage) multifix else NULL, ".", suffix),
    basename(x)),
  gs_cmd = "",
  device = "pngalpha",
  multipage = FALSE,
  multifix = "-%03d",
  suffix = "png",
  antialias = 4,
  resolution = 300,
  replace = TRUE,
  other = "",
  ...
)

Value

the name of the file created

Arguments

x

path for file to be converted

y

path for output file

gdir

directory for png output

out

filename for output file

gs_cmd

passed to find_gs_cmd; perhaps 'gs' or 'gswin32c' or 'mgs' (from Miktex)

device

output device type

multipage

whether to convert multiple pages

multifix

a filename suffix when converting multiple pages

suffix

file extension for output

antialias

font antialiasing

resolution

raster image resolution

replace

whether to delete x if successful

other

other arguments to ghostscript

...

ignored

Examples

Run this code
if (FALSE) {
pdf <- as.pdf(head(Theoph),dir = tempdir())
png <- ghostconvert(pdf, gs_cmd = 'mgs')
browseURL(png)
}

Run the code above in your browser using DataLab