The issue is weird in the sense that I can recreate the exact same PDF report with knitr outside of the Shiny app. The code does work if I use HTML as output format. I have the latest version from MikTex
See code below:
output$report <- downloadHandler(
filename = paste(Sys.Date(), "GebiedsRapportage.html"),content = function(file) {
#tempReport <- file.path(tempdir(), "report_html.Rmd") tempReport <- file.path(tempdir(), "report_pdf.Rmd") #file.copy("report_html.Rmd", tempReport, overwrite = TRUE) file.copy("report_pdf.Rmd", tempReport, overwrite = TRUE) rmarkdown::render(tempReport, output_file = file)
}
)
So, using the html functions works fine, but the PDF function gives me the following error:
Warning: running command '"pdflatex" -halt-on-error -interaction=batchmode "file2e8466131256.tex"' had status 1
Warning: Error in : Failed to compile file2e8466131256.tex.
Stack trace (innermost first):
58: show_latex_error
57: on_error
56: system2_quiet
55: run_engine
54: latexmk_emu
53: tinytex::latexmk
52: latexmk
51: rmarkdown::render
50: download$func [server/server_data_analysis.R#311]
1: runApp
Error : Failed to compile file2e8466131256.tex.
While knitting the file itself without interacting with Shiny generates a PDF perfectly fine.
Anyone encountered the same issue?