embedFonts {grDevices}R Documentation

Embed Fonts in PostScript and PDF


Runs ghostscript to process a PDF or PostScript file and embed all fonts in the file.


embedFonts(file, format, outfile = file, fontpaths = "", options = "")


file a character string giving the name of the original file.
format either "pswrite" or "pdfwrite". If not specified, it is guessed from the suffix of file.
outfile the name of the new file (with fonts embedded).
fontpaths a character vector giving directories that ghostscript will search for fonts.
options a character string containing further options to ghostscript.


This function is not necessary if you just use the standard default fonts for PostScript and PDF output.

If you use a special font, this function is useful for embedding that font in your PostScript or PDF document so that it can be shared with others without them having to install your special font.

If the special font is not installed for ghostscript, you will need to tell ghostscript where the font is, using something like options="-sFONTPATH=path/to/font".

This function relies on a suitable ghostscript executable being in your path, or the environment variable R_GSCMD (the same as bitmap) being set as the full path to the ghostscript executable.


The shell command used to invoke ghostscript is returned invisibly. This may be useful for debugging purposes as you can run the command by hand in a shell to look for problems.

See Also

postscriptFonts, Devices.

[Package grDevices version 2.5.0 Index]