quarto-dev / quarto-dev/quarto-cli

HTML screenshot in PDF with webshot2 requires PNG format

Open
#7,682 0 comments 0 reactions 1 assignee View on GitHub

@cderv is already working on this.

Since Nov 23, 2023.

enhancement
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()
```

image

format: pdf in Quarto will default to fig-format: pdf, which means the Screenshot will be not good by default

image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.