annotatePDFs: annotatePDFs

Description Usage Arguments Details Value Author(s) Examples

View source: R/aveytoolkit_annotatePDFs.R

Description

Add content on top of existing PDF files and can combine them into one file using command line tools

Usage

1
2
3
4
5
6
7
8
9
annotatePDFs(
  host = "localhost",
  inFiles,
  outFiles,
  titles = NULL,
  footers = NULL,
  combineMultiple = TRUE,
  removeMultiple = combineMultiple
)

Arguments

host

name of the host (e.g. <<user>>@<<IP Address>>)

inFiles

a character vector giving the current PDF names

outFiles

a character vector of filenames to save PDFs to. Only the first value is used if combineMultiple is TRUE

titles

a character vector of titles for each plot in the same order as cytoscapeWindowList (default is to use the title slot in the cytoscapeWindowList). Use NULL to omit a title. If only 1 title is given, it will be put on all plots.

footers

a character vector of footers for each plot in the same order as cytoscapeWindowList (default is NULL for no footers). If only 1 footer is given, it will be put on all plots.

combineMultiple

Should multiple windows be combined into a single PDF with one image per page? (Default TRUE)

removeMultiple

Should the temporary files be removed (use only if combining PDFs)?

cytoscapeWindowList

a list of cytoscapeWindow objects for the windows to save

filenames

a character vector of filenames to save PDFs to. Only the first value is used if combineMultiple is TRUE

Details

This function is a wrapper around some shell commands that allows you to annotate multiple PDF files and combine them into 1. This wrapper requires ghostscript and coherent PDF (cpdf) http://www.coherentpdf.com/ on the host machine

Value

an (invisible) list of exit codes for each bash operation

Author(s)

Stefan Avey

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Create 2 dummy plots that I want to combine.
## NOTE: You would never do this because pdf() can create multiple pages
pdf("inFile1.pdf"); plot(1:10); dev.off()
pdf("inFile2.pdf"); plot(10:20); dev.off()

## Annotate some PDFs without combining
## BROKEN!
annotatePDFs(inFiles = paste0("inFile", 1:2, ".pdf"),
             outFiles = paste0("outFile", 1:2, ".pdf"),
             titles = paste0("testTitle", 1:2),
             footers = paste0("testFooter", 1:2),
             combineMultiple = FALSE,
             removeMultiple = FALSE)

## Still keeps the original files because removeMultiple is FALSE
annotatePDFs(inFiles = paste0("inFile", 1:2, ".pdf"),
             outFiles = "outFile.pdf",
             titles = paste0("testTitle", 1:2),
             footers = paste0("testFooter", 1:2),
             combineMultiple = TRUE,
             removeMultiple = FALSE)

## Removes the original input files
annotatePDFs(inFiles = paste0("inFile", 1:2, ".pdf"),
             outFiles = "outFile.pdf",
             titles = paste0("testTitle", 1:2),
             footers = paste0("testFooter", 1:2),
             combineMultiple = TRUE,
             removeMultiple = TRUE)

stefanavey/aveytoolkit documentation built on March 5, 2020, 12:49 a.m.