The Shiny app server code consists of two main parts.
A downloadHandler() function is used to knit the document on demand and passes parameter values to the R markdown document (which is parameterized).
By default,rmarkdown::render() will generate an HTML file that will have all plots and other images embedded directly in the HTML, so you can simply publish or send across the HTML file without any need to handle image files separately. However, you can also generate PDF output using the rmarkdown::render() function just by changing the filename argument of downloadHandler() to "report.pdf". The rmarkdown::render() function has a lot of options to control the processing and output.