Ester Silva
Ester Silva

Reputation: 680

PDF in shiny application - Nothing appears

I made the following script to show 1.pdf, but nothing shows up after clicking on start.

Any comments would be great.

Appreciate!

shinyApp(
  ui <- function(){
    tagList(tabPanel(""),
            pageWithSidebar(
              headerPanel(
                ""
              ),
              sidebarPanel
              (
              tags$head(tags$style(type="text/css", ".well { max-width: 280px; }")),
              actionButton("strt", label = "Start",style="width:32%;"),
              actionButton("logout", "Logout",style="color: red; width:32%;")       
              ),
              mainPanel(tableOutput('path'))
            )
    )   
  },

  server = (function(input, output,session) {
    observeEvent(input$strt, {
      output$path <- renderUI({tags$iframe(src="E:/shiny/Correct/www/1.pdf",style="height:800px; width:100%;scrolling=yes")})   
    })
  })
)

Upvotes: 2

Views: 1235

Answers (1)

Ester Silva
Ester Silva

Reputation: 680

I solved it as follows:

observeEvent(input$strt, {
    addResourcePath("pdf_folder","E:/shiny/Correct")
    output$path <- renderUI({tags$iframe(src="pdf_folder/1.pdf",style="height:800px; width:100%;scrolling=yes")})
})

Upvotes: 1

Related Questions