How to display images in PDFs downloaded from Shiny DT?

shiny
dt

#1

I have the following dataset:

catalogue <- data.frame(Code = c("001", "002", "003", "004", "005", "006", "007", "008"),
                    Product = c("Prod1", "Prod2", "Prod3", "Prod4", "Prod5", "Prod6", "Prod7", "Prod8"),
                    Quantity = c(3, 1, 26, 4, 2, 2, 4, 2),
                    Picture = c("https://i.imgur.com/d2ZWLVx.png",
                                "https://i.imgur.com/d2ZWLVx.png",
                                "https://i.imgur.com/1NBDkl1.png",
                                "https://i.imgur.com/1NBDkl1.png",
                                "https://i.imgur.com/Z2DSLRq.png",
                                "https://i.imgur.com/YIHvU9B.png",
                                "https://i.imgur.com/e6lvBjQ.png",
                                "https://i.imgur.com/mb2CNX5.png"))

catalogue$Image = paste0('<img src = "', catalogue$Picture, '" height = "100"></img>')

And this Shiny app:

library(shiny)
library(tidyverse)
library(DT)

ui <- fluidPage(
        mainPanel(DTOutput("table1")))

server <- function(input, output, session){
             output$table1 <- renderDT(server = FALSE, {
                   catalogue %>% select(-Picture) %>%
                   DT::datatable(escape = FALSE, 
                                 rownames = FALSE,
                                 extensions = 'Buttons', 
                                 options = list(
                                            pageLength = 5,
                                            orientation ='landscape',
                                            dom = 'Bfrtip',
                                            buttons = c('pdf', 'print')))
                     })
                     }


shinyApp(ui, server)

When I open the app on the browser, the pictures from the "Image" column are displayed. However, they aren't when I try to print it or download it as PDF.

Does anyone have a solution for this?

Thanks in advance!