aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-10-08 03:07:50 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2016-10-08 03:07:50 +0200
commit7517eb0ed1a66488b937c039d4bcadefeff6b479 (patch)
tree44ead462c76e8a6f088c7bcc05e266f523a1ee37 /R
parentd22214d9f1b17bd3ab2febe810ab996bebb01410 (diff)
Add a method to write cropped pdf files
Diffstat (limited to 'R')
-rw-r--r--R/chent.R14
1 files changed, 14 insertions, 0 deletions
diff --git a/R/chent.R b/R/chent.R
index dd51798..b2a1da6 100644
--- a/R/chent.R
+++ b/R/chent.R
@@ -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"))
}
)
)

Contact - Imprint