I want to save a table built on {gt}
without losing any columns to the right. I used to do it using gtsave(width = 1600)
(or any number higher than the default 992), but since two weeks ago or so it suddenly stopped responding.
Here’s a reproducible and reduced example of what I need. I’m just creating an object with 15 columns, wider than the default webshot2::webshot()
dimensions. The first webshot()
call shows it, as the image produced is cropped around column 11. The second call should resolve it, but it doesn’t. Even if I tweak the vwidth
parameter, the second image still exactly the same as the first one.
My goal is to save the entire image. Ideally, I would like to understand what’s happening and still use gtsave()
to accomplish it. But I’m inclined to accept other solutions, using other packages to build the tables or to save them.
Thanks in advance.
iris |>
dplyr::bind_cols(iris) |>
dplyr::bind_cols(iris) |>
head(20) |>
gt::gt() |>
gt::as_raw_html() |>
htmltools::HTML() |>
htmltools::save_html("iris.html")
#> New names:
#> New names:
#> • `Sepal.Length` -> `Sepal.Length...1`
#> • `Sepal.Width` -> `Sepal.Width...2`
#> • `Petal.Length` -> `Petal.Length...3`
#> • `Petal.Width` -> `Petal.Width...4`
#> • `Species` -> `Species...5`
#> • `Sepal.Length` -> `Sepal.Length...6`
#> • `Sepal.Width` -> `Sepal.Width...7`
#> • `Petal.Length` -> `Petal.Length...8`
#> • `Petal.Width` -> `Petal.Width...9`
#> • `Species` -> `Species...10`
# crops some columns
webshot2::webshot("iris.html")
# should screenshot the entire table but still crops it
webshot2::webshot("iris.html",
vwidth = 1920,
vheight = 1080)
Created on 2024-09-11 with reprex v2.1.1
Standard output and standard error
file:////private/var/folders/sd/178vts4n6hjc0_krzn0b7jdm0000gn/T/RtmpYbeWe7/reprex-146ee588f494e-fine-bluet/iris.html screenshot completed
file:////private/var/folders/sd/178vts4n6hjc0_krzn0b7jdm0000gn/T/RtmpYbeWe7/reprex-146ee588f494e-fine-bluet/iris.html screenshot completed
1