Learn R Programming

animation (version 2.0-5)

qpdf: A wrapper for the PDF toolkit qpdf

Description

If the tool qpdf is available in the system, it will be called to manipulate the PDF files (especially to compress the PDF files).

Usage

qpdf(input, output, options = "--stream-data=compress")

Arguments

input
the path of the input PDF file
output
the path of the output (if missing, output will be the same as input)
options
options for qpdf (default to be '--stream-data=compress', i.e. compress the PDF files)

Value

  • if ani.options('qpdf') is non-NULL, then this function returns the status of the operation (0 for success; see system); otherwise a warning will be issued

Details

This is a wrapper to call qpdf. The path of qpdf should be set via ani.options(qpdf = 'path/to/qpdf').

See the reference for detailed usage of qpdf.

References

http://qpdf.sourceforge.net/

Examples

Run this code
pdf("huge-plot.pdf")
plot(rnorm(50000))
dev.off()

## Windows
ani.options(qpdf = "D:/Installer/qpdf/bin/qpdf.exe")
qpdf("huge-plot.pdf", output = "huge-plot0.pdf")

## Linux
ani.options(qpdf = "qpdf")
qpdf("huge-plot.pdf", output = "huge-plot1.pdf")

ani.options(qpdf = NULL)

file.info(c("huge-plot.pdf", "huge-plot0.pdf", "huge-plot1.pdf"))["size"]

Run the code above in your browser using DataLab