Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 class 'redcapDbConnection'
exportPdf(
  rcon,
  dir,
  filename = "redcap_forms_download",
  record = NULL,
  events = NULL,
  instruments = NULL,
  all_records = FALSE,
  ...
)

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

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.

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

Details

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

Value

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

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(s)

Benjamin Nutter


redcapAPI

Interface to 'REDCap'

v2.3
GPL-2
Authors
Benjamin Nutter [aut, ctb, cre], Stephen Lane [ctb], Will Beasley [ctb], Jeffrey Horner [ctb], Will Gray [ctb], Jeremy Stephens [ctb], Marcus Lehr [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.