Downloading a PDF Report from a Shiny Application

I have created a Shiny application that utilizes several sliderInputs and those input values are pasted into various textOutputs and htmlOutputs. Our organization's intention is to allow the user to adjust the input values with calculations performed on those input values with returned textOutputs and htmlOutputs.

For example, the user may chose how many hours of sleep they typically need on an evening and the textOutput would renderText with paste("You have ", 24 - input$sleep, " hours awake.")

Now, I am trying to allow the user to download the textOutputs and htmlOutputs as a PDF after they made their adjustments to the sliderInputs. I have read various articles such as Shiny - Generating downloadable reports and other R Markdown documentation and cheat sheets.

I know that I can knit the R Markdown file into a PDF from the R Markdown alone. However, I am having issues with my inputs and their calculations being outputted into the R Markdown file when I click the download button.

Sorry for not providing any code, but I am unsure if I can share this application with you at this time and will consult with my boss. However, I guess included this "psuedocode" so that I could try to understand if these actions are even possible with Shiny and R Markdown.

-Thank you!

You might create a separate Rmd file that acts as a template for outputting whatever figures and tables you want and in the header, specifies your appropriate pdf output format. The first chunk could be to read an RData file with the input data.

Then, from Shiny, you could have a button that saves whatever data would be needed for the template to an RData file and executes a render() on the Rmd file. Upon rendering, the Rmd file will create the pdf output.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.