I can use a() to add a hyperlink in to an external site from my Shiny app,
a("google",href="http://www.google.com")
but how do I make a link to open a pdf (or similar) file? Seems like it should be simple, but I can't find any examples. My question is similar to this one:
Add link to R Shiny Application so link opens in a new browser tab
but I don't know how to structure the href part- where do I put the file to be opened and how do I specify its location? I've tried simple things like http:///C:/Folder/file.pdf or file:///C:/Folder/file.pdf but the file is either not found or wont open.
I am new to shiny and have no html experience, so any suggestions greatly appreciated.
Thanks
Click on Tools > Edit PDF > Link. Then select "Add/Edit Web or Document Link. Next, drag a box to where you want to add the hyperlink to. Last, save the file, and it will add the hyperlink to the document.
Put the pdf file inside the "www" directory (it has to be a subdirectory inside the directory where there are ui.r
and server.r
)
then you can run your shiny with:
a("click on me",target="_blank",href="myfile.pdf")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With