Динамически просматривать PDF-файлы в R FlexDashboard - PullRequest
0 голосов
/ 06 апреля 2020

Я пытаюсь просмотреть файлы .pdf, хранящиеся локально, динамически через flexdashboard. Я могу просматривать отдельные PDF-файлы, используя следующий код:

---
title: "PDF viewer"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
runtime: shiny
---

```{r global, include=FALSE}
library(shiny)
```

Column
-----------------------------------------------------------------------

### PDF viewer

```{r}
# pdf file is stored in the same location as the .Rmd file
tags$iframe(style="height:500px; width:100%", src = "pdf1.pdf")  
```

Но когда я пытаюсь динамически просматривать несколько файлов с помощью выбора ввода, как показано ниже, в iframe появляется сообщение «Not Found». Я что-то не так делаю?

---
title: "PDF viewer"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
runtime: shiny
---

```{r global, include=FALSE}
library(shiny)
```

Column {.sidebar}
-----------------------------------------------------------------------

```{r}
selectInput("pdf_files", "Select pdf", choices = c("pdf1","pdf2","pdf3"), selected = "pdf1")
```

Column
-----------------------------------------------------------------------

### PDF viewer

```{r}
# pdf file is stored in the same location as the .Rmd file

output$pdfviewer = renderUI({
tags$iframe(style="height:500px; width:100%", src = paste0(input$pdf_files, ".pdf"))
}) 

uiOutput("pdfviewer")
```
...