Description Usage Arguments Value See Also Examples
Closes smallpdf device and converts the files into. This is only worthwhile
when the pdf has a lot of information, such as when using image
.
1 2 | smallpdf.off(pdfname, pdfobj = NULL, mypattern, dev,
extra.opts = "-quality 100", outdir, clean = FALSE)
|
pdfname |
filename of PDF to be created |
pdfobj |
List with elements |
mypattern |
regular expression pattern for device files
(from |
dev |
device used to open (from |
extra.opts |
Additional options sent to convert |
outdir |
Directory of intermediate bitmap files (defaults to tempdir()) |
clean |
Delete temporary bitmap files or not? |
The command for the conversion
dev.off
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ## Not run:
## not good for small plots
x = smallpdf(dev="jpeg")
dat = matrix(rnorm(1e3*4), ncol=4)
plot(dat[,1], dat[,2])
plot(dat[,3], dat[,4])
fname = file.path(tempdir(), "smallpdf.pdf")
smallpdf.off(pdfname = fname, mypattern=x$mypattern, dev=x$dev)
print(file.info(fname)$size)
# view.pdf(fname)
fname2 = file.path(tempdir(), "normalpdf.pdf")
pdf(fname2)
plot(dat[,1], dat[,2])
plot(dat[,3], dat[,4])
dev.off()
file.info(fname2)$size
print(file.info(fname2)$size / file.info(fname)$size)
## better for large plots
x = smallpdf(dev="jpeg")
dat = matrix(rnorm(1e6*4), ncol=4)
plot(dat[,1], dat[,2])
plot(dat[,3], dat[,4])
fname = file.path(tempdir(), "smallpdf.pdf")
smallpdf.off(pdfname = fname, mypattern=x$mypattern, dev=x$dev)
file.info(fname)$size
# [1] 3339399
# view.pdf(fname)
fname2 = file.path(tempdir(), "normalpdf.pdf")
pdf(fname2)
plot(dat[,1], dat[,2])
plot(dat[,3], dat[,4])
dev.off()
file.info(fname2)$size
# [1] 13648866
file.info(fname2)$size / file.info(fname)$size
# [1] 4.087222
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.