This is a very silly app but it does print a file. It allows selecting from a set of file names, then clicking the Write button writes the unaltered file out to the app's directory and then clicking Print prints that file. I am using a Linux system, so the print command is lp. I am not sure how to do that on Windows or a Mac.
library(shiny) # Shiny web app
ui <- fluidPage(fluidRow(selectInput("TheFile", "File",
choices = c("csv1.csv", "csv2.csv", "Dummy.csv"))),
fluidRow(actionButton("button1", label = "Write")),
fluidRow(actionButton("button2", label = "Print"))
)
server <- function(input, output, session) {
myCSV <- reactive({
read.csv(input$TheFile)
})
observeEvent(input$button1, {
write.csv(myCSV(), "WrittenFile.csv")
})
observeEvent(input$button2, {
system2(command = "lp", "WrittenFile.csv")
})
}
# run the app
shinyApp(ui, server)