Posit Connect pdf download issues with Shiny App

I have developed a Shiny app that runs a .qmd file as part of a download button. When I run the .qmd file it renders a 2 page pdf. When I host the app locally the download button works and i get a 2 page pdf. When post a shiny app to Posit Connect everything works except the download button. It does download a pdf, however it creates and extra page at the beginning with the title, deletes the subtitle, and bumps the contents down a page (i.e should be 2 pages and is now 3 pages).

output$downloadPDF <- downloadHandler(

    filename = function() {
      filename()
    }, 
    
    content = function(file) {
      # Use withProgress to show a progress bar
      withProgress(message = "Creating Report: ", value = 0, {

        # Stage 1: Increment progress
        incProgress(0.1, detail = "Collecting inputs...")

        # Generate the Quarto params
        params <- list(centercode = center_code(), organ = input$organ_code, filedate = as.character(Sys.Date()))
        
        # debug params
        print("Parameters for Quarto render:")
        print(params)
        
        # debug file path
        # print(paste("Temporary output file path:", temp_output_dir))
        print(paste("file name path:", filename()))
        print(paste("Final output file path:", file))
        
        incProgress(0.2, detail = "Building...")
        
        tryCatch({
          # Use Quarto's render function to create the PDF
          quarto::quarto_render(
            input = "NTS - Short Report - Typst App.qmd",
            output_file = filename(),
            output_format = "typst", 
            execute_params = params
          )
          
          incProgress(0.95, detail = "Downloading report...")
          
          # Copy the generated file to the correct location for download
          file.copy(filename(), file, overwrite = TRUE)
          
        }, error = function(e) {
          
          print(paste("Error generating Quarto report:", e$message))
          
        })
      }
      )
    }
  )
1 Like

Hi there! I would recommend submitting this as a support ticket. Have you submitted a support ticket before? Here's an article on submitting a support ticket.

hello! I submitted a support ticket as well. Just figured I would try both :stuck_out_tongue: . I will also post here what the solution ends up being.

so update. turns out the server side didnt have a recent install of the updated version of Quarto. that was causing the problem.

Hi!
I have a similar issue. I do not have so much experiences by using Posit Connect.
Would you know how to update the version of Quarto?
My error logs are like below.
2025-07-23T16:22:05+02:00 Warning: Error in quarto::quarto_render: :heavy_multiplication_x: Error running quarto cli.
2025-07-23T16:22:05+02:00 Caused by error:
2025-07-23T16:22:05+02:00 ! System command 'quarto' failed

On Rstudio IDE, my shiny app works as well as pdf downloading function. But, the function does not work on the Posit Connect.

I unfortunately do not know how to manage server versions of R, Rstudio, or the packages. If you are the manager you should have the ability and be able to ask posit for some help with that, otherwise probably have to ask who ever manages your server.

Apologies I can't be for more help.