quarto-dev / quarto-dev/quarto-cli
HTML screenshot in PDF with webshot2 requires PNG format
@cderv is already working on this.
Since Nov 23, 2023.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
This was reported in knitr
where a warning has been added.
- check that it is thrown in Quarto
Screenshot for HTML widgets needs to be done with png format, and not pdf, because webshot2 with PDF and Chrome is not good enough
This will work
---
title: test
format: pdf
---
```{r}
#| label: fig-ash-map
#| fig-cap: "Map of Town of Ashland"
#| fig-format: png
library(sf)
library(leaflet)
ashland <- st_read('https://services2.arcgis.com/sKZWgJlU6SekCzQV/arcgis/rest/services/Ashland_Boundary/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson', quiet = TRUE)
leaflet(ashland) %>%
addTiles() %>%
addPolygons()
```
format: pdf in Quarto will default to fig-format: pdf, which means the Screenshot will be not good by default

Maybe should somehow make it the default, here or in knitr. cc @yihui
Later improvement in webshot2 R package may help with this also.
Originally posted by @cderv in https://github.com/quarto-dev/quarto-cli/issues/3279#issuecomment-1824040068
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.