我想将html对象从闪亮的应用程序导出到pdf。为了导出表,我使用.Rmd模板(基于How to make pdf download in shiny app response to user inputs?),但我不知道如何在闪亮的应用程序中将html对象传递给PDF。
示例app:
library(shiny)
ui <- shinyUI(
fluidPage(
fluidRow(
column(width=4,
htmlOutput("Table1"),
htmlOutput("Table2"),
htmlOutput("Table3")
))
)
)
server <- shinyServer(function(input, output, session){
#****************************************
#* Output Components
output$Table1 <- renderUI({
HTML("<div class='progress-group'>
<span class='progress-text'>Add Products to Cart</span>
<span class='progress-number'><b>160</b>/200</span>
<div class='progress sm'>
<div class='progress-bar progress-bar-aqua' style='width: 80%'></div>
</div>
</div>")
})
output$Table2 <- renderUI({
HTML("<div class='progress-group'>
<span class='progress-text'>Complete Purchase</span>
<span class='progress-number'><b>310</b>/400</span>
<div class='progress sm'>
<div class='progress-bar progress-bar-red' style='width: 100%'></div>
</div>
</div>")
})
output$Table3 <- renderUI({
HTML("<div class='progress-group'>
<span class='progress-text'>Visit Premium Page</span>
<span class='progress-number'><b>480</b>/800</span>
<div class='progress sm'>
<div class='progress-bar progress-bar-green' style='width: 10%'></div>
</div>
</div>")
})
})
shinyApp(ui, server)