Vsamfh
Vsamfh

Reputation: 21

Shiny Rmarkdown Hyperlink to local PDF

I'm running an Rmarkdown Document with a Shiny Flexdashboard Output on my shiny server. I'm creating a DT table where one column should be a link to a PDF file stored on my server at

/etc/srv/shiny-server/AppFolder/www/file.pdf

The code for the table looks like this :

datatable(query_result_table,escape = FALSE)

where query_result_table holds the following text string in a column :

"<a href='http://myservername.co.uk:3838/AppFolder/www/file.pdf' target='_blank' >MyFile</a>"

DT does render a link however, when clicking, I get a "Not Found" page. I've tried the following things :

I've thoroughly researched the literature on this issue and the solution usually provided is to create a www folder in the shiny root directory however this does not seem to work in my case, perhaps because this is an Rmd document rather than a ui.R / server.R document couple.

Has anyone resolved this problem before ?

Thanks for your help

Upvotes: 0

Views: 509

Answers (1)

Vsamfh
Vsamfh

Reputation: 21

I have finally rewritten my app in proper shiny format, that is a ui.R and Server.R document couple. The app then successfully accesses the PDF files in the www folder. More generally, there is more flexibility and online literature for the ui.R/server.R format than for .Rmd when it comes to building app so it is a preferable format albeit with a slightly steeper learning curve for synthax.

Upvotes: 0

Related Questions