rstudio/pagedown

Getting error while generating pdf output

Closed this issue · 6 comments

I am trying the below code to generate pdf output -
chrome_print( input = "~/output/pdf_file_1.html", format = "pdf", verbose = TRUE )

I am trying with two different extra_arg one with --headless=old and another with --headless=new.

Error with --headless=old -
image

And error with --headless=new -
image

I believe the headless error is coming because of Chromium.

My session info -
image

Duplicate of #329

@yihui I saw the solution you have mentioned, and it works perfectly in local.

But I have a Shiny application which creates pdf reports using chrome_print() and the application is published in Posit connect. I am not very sure how to make your solution work there. Any suggestions?

Appreciate your help!

You would need to make you application depends on servr package if not already so that the packag is installed in the right version. If you are depending on pagedown already, I believe this will be installed. You would then need to update package locally, and then republish your application to connect so that packages are updated. Workflow can also depend on how you currently manage dependencies. If nothing specific, the package version from your local environment will be used by rsconnect at deployment to recreate online.

Also all this depend on which Chrome version is available for you on Connect.

I am managing all my dependencies through 'renv' and there I have update the package 'servr' to 0.31. In local, through the shiny application I am able to generate the pdf report not, but after I published the application to Rstudio connect, I am getting the same old error.

image

Then maybe this is another issue. The issue that servr is fixing is quite specific.
From #329

Error in force(expr) : 
 Failed to generate output. Reason: Failed to open http://127.0.0.1:6124/favicon.ico (HTTP status code: 404)

Some maybe a different due to chrome update or something else. There could be many reason and highly dependent of what you have in your server.

The issue has been resolved by updating the 'servr' package and migrating the application from RStudio Connect to Posit Connect. Thanks all for your support!!