Skip to content

Instantly share code, notes, and snippets.

@geotheory
Created December 3, 2014 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geotheory/b0c36071b7c0c2b384db to your computer and use it in GitHub Desktop.
Save geotheory/b0c36071b7c0c2b384db to your computer and use it in GitHub Desktop.
library(shiny)
runApp(list(
ui = fluidPage(downloadButton('foo')),
server = function(input, output) {
plotInput = reactive({
plot(1:10)
})
output$foo = downloadHandler(
filename = 'test.pdf',
content = function(file) {
plotInput()
dev.copy2pdf(file = file, width=12, height=8, out.type="pdf")
})
}
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment