Convert PostScript file to RGML file
Converts a PostScript file into an RGML file, which is an XML document describing an image that can be read into R.
PostScriptTrace(file, outfilename, charpath=TRUE, charpos=FALSE, setflat=NULL, defaultcol="black", encoding="ISO-8859-1", scaleEPS=.01)
The name of the PostScript file.
The name of the XML document.
A boolean indicating whether text in the PostScript file should be converted to vector outlines, or left as just text.
A boolean indicating whether text in the PostScript file should be treated as individual characters, each with its own location.
A number that controls how many straight lines a curve is broken into. Lower values break a curve into more lines.
The default colour to use when grImport is unable to determine a colour for a path. This may occur when patterns are present in a PostScript image.
A character value giving the encoding for the resulting RGML file.
A numeric cut-off used to decide when to convert a stroke to a fill if the pen is skewed (the difference between the x-scale factor and the y-scale factor).
This function calls ghostscript to do the conversion, so will only work if ghostscript is installed on your system.
If text is converted to outlines, it can be drawn as outlines,
or filled using a crude algorithm which may or may not work
grid.picture). On the other hand, if text is left
as just text, font information is not stored so the text may
not end up looking much like the original.
Ghostscript is only going to emit text in a single-byte encoding, so the RGML file should have an explicit encoding (otherwise XML parsers are likely to assume UTF-8 and barf on any non-ASCII text). The default encoding used is ISO-8859-1 (ISOLatin1), but you can specify another if you know that the source file has text that ghostscript will emit in a different encoding. There may have to be a bit of guesswork, or inspection of the source PostScript file.