From 7517eb0ed1a66488b937c039d4bcadefeff6b479 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 8 Oct 2016 03:07:50 +0200 Subject: Add a method to write cropped pdf files --- ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ DESCRIPTION | 2 +- R/chent.R | 14 ++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 257e4cc..38c401e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +commit d22214d9f1b17bd3ab2febe810ab996bebb01410 +Author: Johannes Ranke +Date: 2016-09-28 08:56:57 +0200 + + Add drat target + +commit cc5ba9d7cf9435bc6243222691b76d35c866aea5 +Author: Johannes Ranke +Date: 2016-09-27 19:31:04 +0200 + + Update .Rbuildignore + +commit 7915ca3a209a052902893cb583e15cee85854821 +Author: Johannes Ranke +Date: 2016-09-27 17:48:38 +0200 + + Make the new README + +commit 2985771a8fad29e2ebeef533adcf81d621fb5a35 +Author: Johannes Ranke +Date: 2016-09-27 17:46:59 +0200 + + Remove header with metadata, misrendered on github + +commit e23da46d572df2636d68572710b1f2ffbf27b7bd +Author: Johannes Ranke +Date: 2016-09-27 17:39:28 +0200 + + Remove mathjax from README + +commit 5bec469048899cfd785dec4f91ec3840cff18adb +Author: Johannes Ranke +Date: 2016-09-27 16:43:15 +0200 + + Add a bit of info to README + commit b3e6adc8da99f895fa9d289133de60ce1d5bd889 Author: Johannes Ranke Date: 2016-09-27 16:43:15 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 639cfe2..11a63f8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: chents Type: Package Title: Chemical Entities as R Objects Version: 0.2-3 -Date: 2016-09-27 +Date: 2016-10-07 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de")) Description: Utilities for dealing with chemical entities and associated 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")) } ) ) -- cgit v1.2.1