Hi,
I am working in shinydashboard with a downloadButton and an DownloadHandler function to process a Rnw file and download a PDF. When I click on the downloadButton, Chrome opens up a blank window while the program is processing the Rnw file. I can click back on the main Dashboard window and see that hings are running.
This strange behavior appears to happen when the downloadButton is clicked.
Why is Chrome opening up a new window? (also, this is a new development. If only occurred once I completed developing the Rnw file.)
My code:
downloadButton (in the sidebar of the dashboard):
#Action Button
actionButton("profile","View Profile"),
# actionButton("comparison","View Comparison"), Disabled in V1
actionButton("contact","Contact SDO",onclick ="window.open('https://goo.gl/forms/xvyxzq6DGD46rMo42', '_blank')") ,
downloadButton("outputPDF", label="Download PDF Report",
style="color: black; background-color: gray90; border-color: black")
The downloafHandler function:
#Event to output PDF documents
output$outputPDF <- downloadHandler(
filename <- function() {
paste0(input$unit," Community Profile Report ",as.character(Sys.Date()),".pdf")
},
content <- function(file) {
withProgress(message = 'Generating Report', value = 0, { # Initialize Progress bar
tempPDF <- "SDO_Report.pdf"
tempTex <- "SDO_Report.tex"
tempReport <- "SDO_Report.Rnw"
incProgress()
# Set up parameters to pass to Rnw document
outChk <- input$outChk
olistID <- idList
olevel <- input$level
ocurACS <- curACS
ocurYr <- curYr
placelist <- PlaceList
incProgress()
#knitting file and copy to final document
knit(tempReport)
tools::texi2pdf(tempTex)
file.rename(tempPDF, file) # move pdf to file for downloading
incProgress()
}) # Progress Bar
} #Content
) #Download Handler
Thanks in Advance,
AB