downloadReportButtonServer: Download Report Button (server)

View source: R/downloadReport.R

downloadReportButtonServerR Documentation

Download Report Button (server)

Description

Processes and initiates the download of a report.

Usage

downloadReportButtonServer(
  id,
  title = "Report",
  author = "shinyDownload",
  date = format(Sys.time(), "%d %B %Y"),
  reportTemplateMaster,
  reportTemplateImport = NULL,
  params = NULL,
  xelatex = FALSE,
  toc = TRUE,
  ...
)

Arguments

id

Character value that uniquely identifies this instance of the module. Should match up with the id value for one downloadReportButtonUI().

title

The title of the compiled document.

author

The document author's name as a character string.

date

The date to appear at the start of the document. The default value is the current date according to the host system. The date should be provided as a character string.

reportTemplateMaster

The master rmarkdown template for the report. This template should not have a YAML header as this will be added by this report generation script.

reportTemplateImport

A character vector of additional files that may be referred to by reportTemplateMaster. These will be copied into the same directory as reportTemplateMaster. Where imports need to be stored in subdirectories, specify the relative path rather than an absolute path.

params

A list of data/parameters that may be referred to by the report templates. These values can then be referred to in your rmarkdown template by calling values from the params list.

xelatex

Specify that the XeLaTeX compiler should be used for PDF documents instead of the default (pdflatex) compiler. XeLaTeX will will be useful if you have unicode characters in your report. This is a logical value, evaluated according to shiny::isTruthy(). This is ignored if the format from the UI selection is not ".pdf". The host system needs to have access to XeLaTeX or you'll encounter an error when the file compiles.

toc

Logical to determine whether a table of contents is included at the start of the document. If the target file format is HTML, this value can also be written as "float" to get a floating table of contents which is always visible at the side of the screen or "collapse" for a floating toc showing expandable top-level (H2) headers.

...

Arguments to pass to the yaml::as.yaml() method, which may be necessary if params is a data frame and you want to alter the "column.major" option, overriding the "precision" of floating point values, and determining whether to allow escaped "unicode" characters.

Value

Downloads the report with the inputted filename. In the case of a .tex or .md output, the files will be provided as a .zip folder because these are intended to be compiled later by the user, who will need their plots which are attached as separate files. Note that .md formats are exported without a YAML header included. For all other formats, the downloaded file is in the intended format with all plots already embedded into the document. By default, HTML documents compile as a standalone document, meaning PNG figures are embedded into the standalone HTML file.


keithnewman/shinyDownload documentation built on March 13, 2024, 6:35 a.m.