I'm getting the same error when trying to download a PDF report from within a Shiny app. This other post suggests rolling back to RMarkdown 1.8