Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed PDF to shiny app

I don't really know where to begin with this - I have a file that is akin to an appendix that I want made available to my shiny app users. Is possible to embed a PDF from my local drive in to my shiny app & if so is there an ability to have the pdf icon built in? Meaning when you click the pdf icon, you'd download the file specified in the code.

Any help is appreciated!!

like image 635
Ellie Avatar asked Sep 08 '25 11:09

Ellie


1 Answers

Assuming you have a pdf icon file pdficon.png and a pdf file mypdf.pdf, put them in the subfolder www. Then in your app:

library(shiny)

ui <- fluidPage(
  tags$a(tags$img(src="pdficon.png"), href="mypdf.pdf", download="pdfname.pdf")   
)

server <- function(input, output) {
}

shinyApp(ui = ui, server = server)

Then clicking on the icon will download the pdf file under the new name pdfname.pdf.

like image 196
Stéphane Laurent Avatar answered Sep 10 '25 05:09

Stéphane Laurent