haozhu233 / kableExtra

Construct Complex Table with knitr::kable() + pipe.
https://haozhu233.github.io/kableExtra/
Other
688 stars 147 forks source link

Error using save_kable when using library kableExtra to create a table in R Quarto #859

Closed onecare-business-intelligence closed 3 weeks ago

onecare-business-intelligence commented 3 weeks ago

I would like to save a table generated with kableExtra as a PNG file in a quarto report. I'm using the example provided in the help file of save_kable

kable(mtcars[1:5, ], "html") %>%
  kable_styling("striped") %>%
  row_spec(1, color = "red") %>%
  save_kable('test.png')

And receive the following error

Error: rsession-utf8.exe: GeometryDoesNotContainImage `C:\test.png' @ warning/attribute.c/GetImageBoundingBox/534

I'm using R version 4.4.0 (2024-04-24 ucrt) in RStudio with the following libraries:

kableextra 1.4 chromote 0.3.1 webshot 0.5.5 webshot2 0.1.1

Windows 11.

dmurdoch commented 3 weeks ago

This question was also posted on StackOverflow. You should mention that you were given a workaround there: https://stackoverflow.com/a/78977096.

dmurdoch commented 3 weeks ago

Does it work if you use kbl() instead of kable() on the first line? The help page should be updated to do that.

onecare-business-intelligence commented 3 weeks ago

kbl(mtcars[1:5, ], "html") %>% kable_styling("striped") %>% row_spec(1, color = "red") %>% save_kable('test.png')

Returns the same error as when I use kable().

Error: rsession-utf8.exe: GeometryDoesNotContainImage

dmurdoch commented 3 weeks ago

Thanks for the test. I don't see the issue on a Mac, using Quarto or RMarkdown. I'm using the same versions of those packages as you. The version of Chrome is probably relevant because chromote uses it; I'm using Google Chrome 128.0.6613.137 .

onecare-business-intelligence commented 3 weeks ago

Have updated to Chrome Version 128.0.6613.138 (Official Build) (64-bit) and re-run the code on Windows 11 in Quarto and error remains. Error: rsession-utf8.exe: GeometryDoesNotContainImage

dmurdoch commented 3 weeks ago

Actually "rsession-utf8.exe" is part of RStudio or maybe Quarto. So this looks like an RStudio issue, not a kableExtra issue.

onecare-business-intelligence commented 2 weeks ago

Where might I post a bug report for this issue if it isn't a kableExtra issue? Thank you,