首页 > 解决方案 > 使用 Shinydashboard 无法正确显示 PDF

问题描述

我想将一个 pdf 文件嵌入到 Shinydashboard 中,当只有一个选项卡或者我只使用闪亮而不使用仪表板时,它会按预期显示。当我有两个选项卡时,虽然我可以单击屏幕上的按钮来调整其大小,但 PDF 将在第二个选项卡下显示为一个细条(参见屏幕截图)。有人可以帮助找出问题所在吗?这仅在 Chrome 中发生,但在 Edge 或 IE 中可以正常工作。提前致谢!

示例代码:

dashboardPage(      
  dashboardHeader(title = "Test"),

  ui<-dashboardSidebar(
    sidebarMenu(
      menuItem("Model", tabName = "model"),
      menuItem("Instruction", tabName = "inst"),
      id = "tabm"
    )
  ),

  dashboardBody(
    tabItems(
      tabItem(tabName = "model",
              h2("first tab content"),
              tags$iframe(style="height:650px; width:100%; scrolling=yes",
                          src="shinyTexManual.pdf")
      ),
      tabItem(
        tabName = "inst",
        fluidPage(
          sliderInput("slider", "Slider", 1, 100, 50),
          tags$iframe(style="height:650px; width:100%; scrolling=yes",
                      src="shinyTexManual.pdf")
        )
      )
    )
  )
)
server <- function(input, output) { }

标签: rpdfshinyshinydashboard

解决方案


推荐阅读