Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
显示非';t存储在R Shining应用程序内的www文件夹中_R_Pdf_Iframe_Shiny_Src - Fatal编程技术网

显示非';t存储在R Shining应用程序内的www文件夹中

显示非';t存储在R Shining应用程序内的www文件夹中,r,pdf,iframe,shiny,src,R,Pdf,Iframe,Shiny,Src,我想在R Shining应用程序中为不在www文件夹中的pdf创建pdf查看器 在下面的代码中,如果my_path未引用www文件夹,则它似乎不起作用 library(shiny) ui <- fluidPage( uiOutput("PDF_WINDOW") ) server <- function(input, output, session) { output$PDF_WINDOW <- renderUI({ tags$iframe

我想在R Shining应用程序中为不在www文件夹中的pdf创建pdf查看器

在下面的代码中,如果
my_path
未引用www文件夹,则它似乎不起作用

library(shiny)

ui <- fluidPage(
  uiOutput("PDF_WINDOW")
)

server <- function(input, output, session) {
  output$PDF_WINDOW <- renderUI({
    tags$iframe(style="height:485px; width:100%", src= my_path)
  })
}

shinyApp(ui, server)
库(闪亮)

ui您需要使包含pdf文件的文件夹可供Web服务器使用。这可以通过
addResourcePath
完成:

library(shiny)

my_path <- "/path/to/folder/containing/the/pdf/file"
addResourcePath(prefix = "my_pdf_resource", directoryPath = my_path)

ui <- fluidPage(
  uiOutput("PDF_WINDOW")
)

server <- function(input, output, session) {
  output$PDF_WINDOW <- renderUI({
    tags$iframe(style="height:485px; width:100%", src = "my_pdf_resource/my_pdf_filename.pdf")
  })
}

shinyApp(ui, server)
库(闪亮)

我的路太长了!你真是天才!!