Learn R Programming

simsalapar (version 1.0-12)

device: Cropping and Font Embedding PDF Device

Description

dev.off.pdf() is a wrapper of dev.off() which is meant for closing a pdf device. It also performs cropping and font embedding if chosen.

Usage

dev.off.pdf(file="Rplots.pdf", crop=NULL, embedFonts="", ...)

Value

invisible().

Arguments

file

output file name including extension .pdf.

crop

cropping command, can be one of:

NULL

crop with the command "pdfcrop --pdftexcmd pdftex file file 1>/dev/null 2>&1". This is suitable for Unix; for non-Unix, no cropping is done.

character

a string containing the crop command.

""

do not crop.

embedFonts

font embedding command, can be one of:

NULL

embed fonts with the command embedFonts(file, options="-dSubsetFonts=true -dEmbedAllFonts=true -dPDFSETTINGS=/printer -dUseCIEColor"). This is suitable for Unix; for non-Unix, no font embedding is done.

character

a string containing a font embedding command.

""

do not embed fonts.

...

additional arguments passed to dev.off().

Author

Marius Hofert

See Also

dev.off() for closing a device, embedFonts() for font embedding. sfsmisc's pdf.end() for another approach.

Examples

Run this code
## typical usage
doPDF <- !dev.interactive(orNone=TRUE)
if(doPDF) pdf(file=(file <- "crop_device.pdf"), width=6, height=6)
plot(1)
if(doPDF) dev.off.pdf(file)
if(file.exists(file)) file.remove(file)

Run the code above in your browser using DataLab