knitting to pdf reduces table width
Great package, thanks. I can knit to pdf using your package, but the table width is reduced to less than page width. When knitting to html the table is full page width. Is there a fix?
knitr::opts_chunk$set(echo = TRUE)
library(reactable)
library(tidyverse)
reactable(mtcars,
defaultColDef = colDef(
align = "center",
minWidth = 40,
headerStyle = list(background = "#f7f7f8")
),
style = list(fontFamily = "Work Sans, sans-serif", fontSize = "10px"),
pagination=FALSE,
highlight = TRUE,
bordered = TRUE,
striped=TRUE,
compact=TRUE,
fullWidth = TRUE
)
I think this is the same issue as https://github.com/glin/reactable/issues/67#issuecomment-674581250. The problem is that the browser engine in the webshot package is too old, and unfortunately, I don't think there's a good solution yet. The new webshot2 package should support reactable, but it's not on CRAN or supported by knitr/rmarkdown yet.
You could either use webshot2 to take a screenshot of the table and insert it in the PDF, or use another table package for PDFs.
Thanks for your reply, I'll make a plan and wait for the webshot2 package to get on CRAN