Situation
Hi. I'm trying to download the .pptx Rmarkdown report from shinyapps.io. The problem is, I want to download a graph with a multibyte character. (Japanese)
Since shinyapps.io does not provide Japanese font, I use the showtext
package to render the graph with a multibyte character, and it works well with displaying in the browser.
However, when I try to download the .pptx file via downloadHandler()
using rmarkdown::render
, downloaded .pptx file come with Japanese font (and all the multibyte character within the font "collapsed".)
Reproducible example
#app.r
library(shiny)
library(tibble)
library(ggplot2)
library(magrittr)
library(showtext)
showtext.auto(TRUE)
ui <- fluidPage(
downloadButton("dl","DL"),
plotOutput("plot")
)
server <- function(input, output) {
tempplot <- reactive({
dat <- tibble(x = c("い","ろ","は"),
y = c(10,20,30))
ggplot(dat) +
geom_col(aes(x = x, y = y))
})
output$plot <- renderPlot({
tempplot()
})
output$dl <- downloadHandler(
filename = function(){"test.pptx"},
content = function(con){
rmarkdown::render(input = "test.Rmd",
output_file = con)
}
)
}
shinyApp(ui = ui, server = server)
#global.R
library(shiny)
library(tibble)
library(ggplot2)
library(magrittr)
library(showtext)
#test.Rmd --- title: "test" output: powerpoint_presentation --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ## マルチバイト文字 ```{r} tempplot() ```
Result
This is what displayed in the application at shinyapps.io. Multibyte characters are displayed as intended.
Whereas, downloaded .pptx file is as follows.
Question
Is there any way I can download the .pptx file with multibyte character from shinyapps.io? (As displayed in the app in shinyapps.io.