tests/compressPDF.R

library("R.utils")

oopts <- options(warn=1)

message("*** compressPDF() ...")

pathname <- file.path(R.home("doc"), "NEWS.pdf")
if (file_test("-f", pathname)) {
  tryCatch({
    pathnameZ <- compressPDF(pathname)
    print(pathnameZ)

    pathnameZ <- compressPDF(pathname, skip=TRUE)
    print(pathnameZ)

    pathnameZ <- compressPDF(pathname, overwrite=TRUE)
    print(pathnameZ)

    file.remove(pathnameZ)
    removeDirectory(dirname(pathnameZ))
  }, error = function(ex) {
    warning("TEST ERROR: ", ex$message)
  })
}

message("*** compressPDF() ...DONE")

options(oopts)

Try the R.utils package in your browser

Any scripts or data that you put into this service are public.

R.utils documentation built on Nov. 18, 2023, 1:09 a.m.