diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-10-08 03:07:50 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-10-08 03:07:50 +0200 |
commit | 7517eb0ed1a66488b937c039d4bcadefeff6b479 (patch) | |
tree | 44ead462c76e8a6f088c7bcc05e266f523a1ee37 /R | |
parent | d22214d9f1b17bd3ab2febe810ab996bebb01410 (diff) |
Add a method to write cropped pdf files
Diffstat (limited to 'R')
-rw-r--r-- | R/chent.R | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -241,6 +241,20 @@ chent <- R6Class("chent", } if (!exists(to, self$TPs)) stop(to, " was not found in TPs") self$ff[i, ] <- c(from, to, ff, comment, pages) + }, + pdf = function(file = paste0(self$identifier, ".pdf"), dir = "structures") { + if (!dir.exists("structures")) { + message("Directory '", dir, "' does not exist") + message("Creating directory '", dir, "'") + dir.create(dir) + } + path = file.path(dir, file) + message("Creating file '", path, "'") + pdf(path) + plot(self) + dev.off() + message("Cropping file '", path, "' using pdfcrop") + system(paste("pdfcrop --margin 10", path, path, "> /dev/null")) } ) ) |