ghostconvert: Call Ghostscript.

Description Usage Arguments Value Examples

View source: R/png.R

Description

Call Ghostscript, converting by default from PDF to PNG.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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 = "",
  ...
)

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

Value

the name of the file created

Examples

1
2
3
4
5
6
## Not run: 
pdf <- as.pdf(head(Theoph),dir = tempdir())
png <- ghostconvert(pdf, gs_cmd = 'mgs')
browseURL(png)

## End(Not run)

bergsmat/latexpdf documentation built on Jan. 16, 2022, 2:14 p.m.