Markus Skyttner 2019-06-10
# to render this into GitHub markdown:
# rmarkdown::render("name_of_this_file.R")
library(staplr)
# this is the PDF form/template to be filled
pdf <- system.file('testForm.pdf', package = 'staplr')
# view the PDF file
#file.show(pdf)
# find the fields in the PDF
fields <- get_fields(pdf)
# change values
fields$TextField1$value <-
"Blaha - this is the input I want to provide"
# output the results to a new file
set_fields(pdf, "output.pdf", fields)
# inspect the result
#file.show("output.pdf")
The gist above was generated from the R script below, saved as
staplr.R
and then rendered into markdown withrmarkdown::render('staplr.R')
, note the YAML front matter which converts the R script to a GitHub flavored markdown file: