Learn R Programming

redcapAPI (version 2.7.4)

exportPdf: Export PDF file of Data Collection Instruments (either as blank or with data)

Description

This function allows you to download PDF files of data collection instruments. The download may be with or without collected data, and may return a single record, multiple records, or all records.

Usage

exportPdf(
  rcon,
  dir,
  filename = "redcap_forms_download",
  record = NULL,
  events = NULL,
  instruments = NULL,
  all_records = FALSE,
  ...
)

# S3 method for redcapApiConnection exportPdf( rcon, dir, filename = "redcap_forms_download", record = NULL, events = NULL, instruments = NULL, all_records = FALSE, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Value

Creates a PDF file that is saved to the directory specified by the user.

Arguments

rcon

A REDCap connection object as generated by redcapConnection.

dir

The directory into which the file should be saved.

filename

character(1). The base of the file name. If record = NULL, it will be appended with "_blank.pdf". If record has a value, it will be appended with "_record_[record id].pdf"

record

The record id for which forms should be downloaded. May only have length 1. May be either character or numeric.

events

The events for which forms should be downloaded

instruments

The instruments for which forms should be downloaded

all_records

Logical. If TRUE forms for all records are downloaded. When TRUE, this overrides the records argument.

...

Arguments to be passed to other methods.

error_handling

An option for how to handle errors returned by the API. see redcap_error

config

list Additional configuration parameters to pass to POST. These are appended to any parameters in rcon$config.

api_param

list Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

REDCap API Documentation

This function allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). If the user has "No Access" data export rights, they will not be able to use this method, and an error will be returned.

REDCap Version

6.5.0+

Known REDCap Limitations

None

Author

Benjamin Nutter

Details

This function mimics the behavior of "Download PDF of Instruments" button on the REDCap user interface.