What I’m trying is to generate a dynamic html (public report) to print with a thermal printer
I have an rmd with parameters in a shiny-server app. I want to save the “file.hmtl” result in the public folder www for using it in a iframe.
I can generate and download the “file.html” from the temp directory, buy I can’t copy it.
This is the actual code. Works fine if I manually save a “ticket.html” file in the www folder – also works fine locally copy form temp folder to www folder – I think is permission problem with shiny-server folder on file.copy
resp <- data.frame("Ticket" = 2983, 'product' = "Black Angus cheeseburger")
params <- list(datos = resp)
curdir <- getwd()
src <- normalizePath('ticket.Rmd')
owd <- setwd(tempdir())
on.exit(setwd(owd))
file.copy(src, 'report.Rmd', overwrite = TRUE)
out <- rmarkdown::render('report.Rmd',
output_format = 'html_document', params = params,
envir = new.env(parent = globalenv()))
resp <- file.copy(out, paste0(curdir,'/www/ticket.html'), overwrite = TRUE)
showModal(div(class = "modal-ticket",
modalDialog(tags$iframe(src='ticket.html',
scrolling = 'no',
height = '350px'),
easyClose = TRUE, size = 'l',
footer = modalButton("No ticket")
))
)
Luis Espinosa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.